A base template for all sorts of typefull boolean flags, to be used more in the future. More...
#include <toggle_enums.h>
Public Member Functions | |
operator bool () const | |
implicit convertible More... | |
YesNo & | operator= (YesNo &&)=default |
Defaulted move assignment op. More... | |
YesNo & | operator= (YesNo const &)=default |
Defaulted copy assignment op. More... | |
YesNo ()=default | |
Defaulted standard ctor. More... | |
YesNo (int v) | |
Default ctor. More... | |
YesNo (YesNo &&)=default | |
Defaulted move ctor. More... | |
YesNo (YesNo const &)=default | |
Defaulted copy ctor. More... | |
Static Public Member Functions | |
static YesNo | n () |
factor for 'false' flags More... | |
static YesNo | y () |
factory for 'true' flags More... | |
Public Attributes | |
bool | value |
storage More... | |
A base template for all sorts of typefull boolean flags, to be used more in the future.
Create your own flag with using YourFlag = YesNo<struct _yourflag>;
and then use either the static functions y()
and n()
or construction by passing a boolean to construct objects.
The advantage over plain bool flags is that you don't need to worry about argument order, the advantage over enums is that this is implicitly convertible to bool.