|
A library for working with phylogenetic and population genetic data.
v0.27.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_CORE_STD_H_
2 #define GENESIS_UTILS_CORE_STD_H_
48 # define GENESIS_FUNC __PRETTY_FUNCTION__
50 # if defined __STDC_VERSION__
51 # define GENESIS_FUNC __func__
53 # define GENESIS_FUNC __FUNCTION__
66 #define GENESIS_LIKELY
67 #define GENESIS_UNLIKELY
81 template<
typename T,
typename... Args>
84 return std::unique_ptr<T>(
new T(std::forward<Args>(args)...));
110 template <
typename T>
113 return seed ^ ( std::hash<T>()( value ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ));
116 template <
typename T>
119 return seed ^ ( std::hash<T>()( value ) + 0x9e3779b97f4a7c16 + ( seed << 12 ) + ( seed >> 4 ));
125 template <
typename T>
126 inline constexpr std::size_t
hash_combine( std::size_t seed, T
const& value )
137 (
sizeof( std::size_t ) == 4 ) || (
sizeof( std::size_t ) == 8 ),
138 "Need sizeof( std::size_t ) to be 4 or 8 (32bit or 64bit integer)"
140 return (
sizeof( std::size_t ) == 4 )
158 #endif // include guard
ArrowOperatorProxy(T const &v)
Proxy class to hold an element accessible via arrow operator.
constexpr std::size_t hash_combine_32(std::size_t seed, T const &value)
constexpr std::size_t hash_combine_64(std::size_t seed, T const &value)
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::unique_ptr< T > make_unique(Args &&... args)
Returns a std::unique_ptr for a given type.
constexpr std::size_t hash_combine(std::size_t seed, T const &value)
Combine a seed value (e.g., another hash) with the hash of a given type.