Add unity build support
This commit is contained in:
@@ -363,6 +363,38 @@ namespace Nz
|
||||
return (value & (value - 1)) == 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Helper function to retrieve a key in a map which has to exist
|
||||
* \return Value associated with key
|
||||
*
|
||||
* \param map Map
|
||||
* \param key Key, has to exist in map
|
||||
*/
|
||||
template<typename K, typename V>
|
||||
V& Retrieve(std::unordered_map<K, V>& map, const K& key)
|
||||
{
|
||||
auto it = map.find(key);
|
||||
assert(it != map.end());
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Helper function to retrieve a key in a map which has to exist
|
||||
* \return Value associated with key
|
||||
*
|
||||
* \param map Map
|
||||
* \param key Key, has to exist in map
|
||||
*/
|
||||
template<typename K, typename V>
|
||||
const V& Retrieve(const std::unordered_map<K, V>& map, const K& key)
|
||||
{
|
||||
auto it = map.find(key);
|
||||
assert(it != map.end());
|
||||
return it->second;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \ingroup core
|
||||
* \brief Reverse the bit order of the integer
|
||||
@@ -472,6 +504,12 @@ namespace Nz
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T, typename U>
|
||||
std::unique_ptr<T> StaticUniquePointerCast(std::unique_ptr<U>&& ptr)
|
||||
{
|
||||
return std::unique_ptr<T>(SafeCast<T*>(ptr.release()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
constexpr auto UnderlyingCast(T value) -> std::underlying_type_t<T>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user