mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
feat(Core/Util): AsUnderlyingType (#6117)
* Add AsUnderlyingType function to cast enum value to its underlying type (avoids repeating std::underlying_type everywhere)
(cherry picked from commit fdd9227b23)
Co-Authored-By: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -892,4 +892,11 @@ private:
|
||||
EventStore _eventMap;
|
||||
};
|
||||
|
||||
template<typename E>
|
||||
typename std::underlying_type<E>::type AsUnderlyingType(E enumValue)
|
||||
{
|
||||
static_assert(std::is_enum<E>::value, "AsUnderlyingType can only be used with enums");
|
||||
return static_cast<typename std::underlying_type<E>::type>(enumValue);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user