|
template<typename Enum , typename Underlying = typename std::underlying_type<Enum>::type, detail::EnableIfEnum< Enum > = true> |
constexpr Underlying | gears::enums::to_underlying (Enum x) noexcept |
| Casts an enum to its underlying type. More...
|
|
template<typename Enum , typename... Enums, detail::EnableIfEnum< Enum, Enums...> = true> |
Enum & | gears::enums::set_flags (Enum &flags, Enums &&...args) noexcept |
| Sets the flags to an enum. More...
|
|
template<typename Enum , typename... Enums, detail::EnableIfEnum< Enum, Enums...> = true> |
Enum & | gears::enums::remove_flags (Enum &flags, Enums &&...args) noexcept |
| Unsets the flags to an enum. More...
|
|
template<typename Enum , typename... Enums, detail::EnableIfEnum< Enum, Enums...> = true> |
constexpr bool | gears::enums::has_flags (const Enum &flags, Enums &&...args) noexcept |
| Checks if flags are set. More...
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr Enum | gears::enums::operators::operator~ (const Enum &x) noexcept |
| Implements ~x on enums.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr Enum | gears::enums::operators::operator| (const Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs | rhs on enums.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr Enum | gears::enums::operators::operator& (const Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs & rhs on enums.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr Enum | gears::enums::operators::operator^ (const Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs ^ rhs on enums.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
Enum & | gears::enums::operators::operator|= (Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs |= rhs on enums.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
Enum & | gears::enums::operators::operator&= (Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs &= rhs on enums.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
Enum & | gears::enums::operators::operator^= (Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs ^= rhs on enums.
|
|
template<typename Enum , typename... Enums, detail::EnableIfEnum< Enum, Enums...> = true> |
constexpr Enum | gears::enums::activate_flags (const Enum &first, const Enum &second, Enums &&...rest) noexcept |
| Activates the flags specified. More...
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr bool | gears::enums::operators::operator!= (const Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs != rhs.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr bool | gears::enums::operators::operator!= (const Enum &lhs, const detail::Underlying< Enum > &rhs) noexcept |
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr bool | gears::enums::operators::operator!= (const detail::Underlying< Enum > &lhs, const Enum &rhs) noexcept |
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr bool | gears::enums::operators::operator== (const Enum &lhs, const Enum &rhs) noexcept |
| Implements lhs == rhs.
|
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr bool | gears::enums::operators::operator== (const Enum &lhs, const detail::Underlying< Enum > &rhs) noexcept |
|
template<typename Enum , typename std::enable_if< std::is_enum< Enum >::value, int >::type = 0> |
constexpr bool | gears::enums::operators::operator== (const detail::Underlying< Enum > &lhs, const Enum &rhs) noexcept |
|
This module is meant to help with the usage of enums as bitmasks. C++11 has added support for strongly typed enums through the usage of enum class
or enum struct
. A big problem with using the strongly typed enums is that the usual operators are unavailable for usage. For example, the following code is not well formed:
The purpose of this module is to aid in the usage of enums by making it a little bit easier than having to define the entire set of operators yourself. To fix the error above, all you have to do is the following: