VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
DtEnumClassFlag.h File Reference

Go to the source code of this file.

Classes

struct  is_flag< T, bool >
 
struct  is_flag< T, true >
 

Functions

template<typename T , typename std::enable_if< is_flag< T >::value >::type * = nullptr>
operator| (T lhs, T rhs)
 
template<typename T , typename std::enable_if< is_flag< T >::value >::type * = nullptr>
operator& (T lhs, T rhs)
 

Detailed Description

Contains generic operator overrides for enum classes to allow for bitwise operations, e.g. | and &.

By default, enum classes do not support bitwise operations. This header partially addresses that by overriding the | and & bitwise operators in a generic way (using templates):

To make some enum class (some_enum) support bitwise operations: enum class some_enum : unsigned int { foo = 0x0001, bar = 0x0002, boo = 0x0004 };

You would do the following: #include <vrvUtil/DtEnumClassFlag.h>

template <> struct is_flag<some_enum> : std::true_type { };

Function Documentation

template<typename T , typename std::enable_if< is_flag< T >::value >::type * = nullptr>
T operator| ( lhs,
rhs 
)
template<typename T , typename std::enable_if< is_flag< T >::value >::type * = nullptr>
T operator& ( lhs,
rhs 
)

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)