File indexing completed on 2025-01-18 09:57:44
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef GAUDIKERNEL_TAGGEDBOOL_H
0010 #define GAUDIKERNEL_TAGGEDBOOL_H
0011
0012 namespace Gaudi {
0013 namespace tagged_bool_ns {
0014
0015 template <typename Tag>
0016 class tagged_bool {
0017 bool value;
0018 template <typename >
0019 friend class tagged_bool;
0020
0021 public:
0022 constexpr explicit tagged_bool( bool v ) : value{ v } {}
0023
0024 constexpr explicit tagged_bool( int ) = delete;
0025 constexpr explicit tagged_bool( double ) = delete;
0026 constexpr explicit tagged_bool( void* ) = delete;
0027
0028 template <typename OtherTag>
0029 constexpr explicit tagged_bool( tagged_bool<OtherTag> b ) : value{ b.value } {}
0030
0031 constexpr explicit operator bool() const { return value; }
0032 constexpr tagged_bool operator!() const { return tagged_bool{ !value }; }
0033
0034 friend constexpr bool operator==( tagged_bool l, tagged_bool r ) { return l.value == r.value; }
0035 friend constexpr bool operator!=( tagged_bool l, tagged_bool r ) { return l.value != r.value; }
0036 };
0037 }
0038
0039 using tagged_bool_ns::tagged_bool;
0040 }
0041
0042 #endif