Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
utility.ipp File Reference
#include "Common/utility.h"
#include "Common/assertion.h"
#include "Common/exceptions.h"
#include <utility>
#include <climits>
#include <limits>

Go to the source code of this file.

Namespaces

namespace  ph
 The root for all renderer implementations.
 
namespace  ph::detail
 Implementation detail mainly for internal usages.
 

Functions

template<typename T , std::size_t... Is>
constexpr std::array< T, sizeof...(Is)> ph::detail::make_array (T element, std::index_sequence< Is... >)
 
template<typename T >
consteval std::size_t ph::sizeof_in_bits ()
 Calculates number of bits an instance of type T occupies.
 
template<typename T , std::size_t N>
constexpr std::array< T, N > ph::make_array (const T &element)
 Creates an std::array filled with the same element.
 
template<std::integral DstType, std::integral SrcType>
DstType ph::lossless_integer_cast (const SrcType &src)
 
template<std::floating_point DstType, std::floating_point SrcType>
DstType ph::lossless_float_cast (const SrcType &src)
 
template<typename DstType , typename SrcType >
DstType ph::lossless_cast (const SrcType &src)
 Cast numeric value to another type without any loss of information. If there is any possible overflow or numeric precision loss, exception is thrown.
 
template<typename DstType , typename SrcType >
DstType ph::lossless_cast (const SrcType &src, DstType *const out_dst)