Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename TKey, typename TInKey>
- xGame_FORCEINLINE decltype(auto) SimplifyKey(const TInKey& inKey)
- {
- if constexpr (std::is_same_v<TKey, TInKey>)
- {
- return inKey;
- }
- else
- {
- decltype(auto) key = xGame_SimplifyKey(inKey);
- typedef std::decay_t<decltype(key)> SimpleKeyType;
- if constexpr (std::is_same_v<SimpleKeyType, TKey>)
- {
- return key;
- }
- else
- {
- if constexpr (std::is_trivial_v<TKey> &&
- std::is_convertible_v<SimpleKeyType, TKey>)
- {
- return static_cast<TKey>(key);
- }
- else
- {
- static_assert(
- std::is_same_v<MP::KeyClass<SimpleKeyType>, MP::KeyClass<TKey>>,
- "Lookup key and table key must be in the same key class. "
- "Use the xGame_Ext_SimplifyKey or xGame_Ext_KeyClass extension "
- "points to enable heterogeneous lookup for your types.");
- return key;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement