32 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
33 inline constexpr FLAGNAME
operator|(FLAGNAME a, FLAGNAME b)
35 return FLAGNAME(std::underlying_type_t<FLAGNAME>(a) | std::underlying_type_t<FLAGNAME>(b));
39 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
40 inline constexpr FLAGNAME
operator+(FLAGNAME a, FLAGNAME b)
42 return FLAGNAME(std::underlying_type_t<FLAGNAME>(a) | std::underlying_type_t<FLAGNAME>(b));
46 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
47 inline constexpr FLAGNAME
operator&(FLAGNAME a, FLAGNAME b)
49 return FLAGNAME(std::underlying_type_t<FLAGNAME>(a) & std::underlying_type_t<FLAGNAME>(b));
53 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
54 inline constexpr FLAGNAME
operator^(FLAGNAME a, FLAGNAME b)
56 return FLAGNAME(std::underlying_type_t<FLAGNAME>(a) ^ std::underlying_type_t<FLAGNAME>(b));
60 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
63 return FLAGNAME(~std::underlying_type_t<FLAGNAME>(a));
67 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
68 inline constexpr FLAGNAME&
operator&=(FLAGNAME& a, FLAGNAME b)
75 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
76 inline constexpr FLAGNAME&
operator|=(FLAGNAME& a, FLAGNAME b)
83 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
84 inline constexpr FLAGNAME&
operator+=(FLAGNAME& a, FLAGNAME b)
91 template<
typename FLAGNAME>
requires std::is_enum_v<FLAGNAME>
92 inline constexpr FLAGNAME&
operator^=(FLAGNAME& a, FLAGNAME b)
99 template<
typename FLAGNAME,
typename FLAG>
requires std::is_enum_v<FLAG> && std::is_same_v<scalar_t<FLAGNAME>, FLAG>
100 inline constexpr auto is_set(
const FLAGNAME& a,
const FLAG& flag)
103 if constexpr (std::is_same_v<FLAGNAME, FLAG>)
return ((a & flag) == flag);
106 else return eq((a & flag), flag);
114 template<
typename ENUM>
requires concepts::reflection::enumerate<ENUM>
Definition: aggregatebsdf.h:29
constexpr FLAGNAME operator+(FLAGNAME a, FLAGNAME b)
Conact two flags.
Definition: flags.h:40
constexpr FLAGNAME & operator^=(FLAGNAME &a, FLAGNAME b)
Update 'a' with a^b,.
Definition: flags.h:92
constexpr FLAGNAME & operator+=(FLAGNAME &a, FLAGNAME b)
Update 'a' with a+b.
Definition: flags.h:84
constexpr FLAGNAME operator~(FLAGNAME a)
Set/unset flag that are unset/set respectively.
Definition: flags.h:61
constexpr FLAGNAME & operator|=(FLAGNAME &a, FLAGNAME b)
Update 'a' with a | b.
Definition: flags.h:76
constexpr FLAGNAME operator|(FLAGNAME a, FLAGNAME b)
Concat two flags.
Definition: flags.h:33
std::ostream & operator<<(std::ostream &s, const BSDF &bsdf)
Definition: bsdf_base.h:138
constexpr FLAGNAME & operator&=(FLAGNAME &a, FLAGNAME b)
Update 'a' with a & b.
Definition: flags.h:68
std::string toString(const T &)
toString alias
Definition: stringconvert.h:594
constexpr FLAGNAME operator&(FLAGNAME a, FLAGNAME b)
Get the shared flags.
Definition: flags.h:47
constexpr auto is_set(const FLAGNAME &a, const FLAG &flag)
Check if all in 'flag' are also set in 'a'; compatible with packet types.
Definition: flags.h:100
constexpr FLAGNAME operator^(FLAGNAME a, FLAGNAME b)
Get the flags from 'a' that are not in 'b'.
Definition: flags.h:54
Compile-time reflection of: