template struct FlagTraits { static VULKAN_HPP_CONST_OR_CONSTEXPR bool isBitmask = false; }; template class Flags { public: using MaskType = typename std::underlying_type::type; // constructors VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT : m_mask( 0 ) {} VULKAN_HPP_CONSTEXPR Flags( BitType bit ) VULKAN_HPP_NOEXCEPT : m_mask( static_cast( bit ) ) {} VULKAN_HPP_CONSTEXPR Flags( Flags const & rhs ) VULKAN_HPP_NOEXCEPT = default; VULKAN_HPP_CONSTEXPR explicit Flags( MaskType flags ) VULKAN_HPP_NOEXCEPT : m_mask( flags ) {} // relational operators #if defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) auto operator<=>( Flags const & ) const = default; #else VULKAN_HPP_CONSTEXPR bool operator<( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return m_mask < rhs.m_mask; } VULKAN_HPP_CONSTEXPR bool operator<=( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return m_mask <= rhs.m_mask; } VULKAN_HPP_CONSTEXPR bool operator>( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return m_mask > rhs.m_mask; } VULKAN_HPP_CONSTEXPR bool operator>=( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return m_mask >= rhs.m_mask; } VULKAN_HPP_CONSTEXPR bool operator==( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return m_mask == rhs.m_mask; } VULKAN_HPP_CONSTEXPR bool operator!=( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return m_mask != rhs.m_mask; } #endif // logical operator VULKAN_HPP_CONSTEXPR bool operator!() const VULKAN_HPP_NOEXCEPT { return !m_mask; } // bitwise operators VULKAN_HPP_CONSTEXPR Flags operator&( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return Flags( m_mask & rhs.m_mask ); } VULKAN_HPP_CONSTEXPR Flags operator|( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return Flags( m_mask | rhs.m_mask ); } VULKAN_HPP_CONSTEXPR Flags operator^( Flags const & rhs ) const VULKAN_HPP_NOEXCEPT { return Flags( m_mask ^ rhs.m_mask ); } VULKAN_HPP_CONSTEXPR Flags operator~() const VULKAN_HPP_NOEXCEPT { return Flags( m_mask ^ FlagTraits::allFlags ); } // assignment operators VULKAN_HPP_CONSTEXPR_14 Flags & operator=( Flags const & rhs ) VULKAN_HPP_NOEXCEPT = default; VULKAN_HPP_CONSTEXPR_14 Flags & operator|=( Flags const & rhs ) VULKAN_HPP_NOEXCEPT { m_mask |= rhs.m_mask; return *this; } VULKAN_HPP_CONSTEXPR_14 Flags & operator&=( Flags const & rhs ) VULKAN_HPP_NOEXCEPT { m_mask &= rhs.m_mask; return *this; } VULKAN_HPP_CONSTEXPR_14 Flags & operator^=( Flags const & rhs ) VULKAN_HPP_NOEXCEPT { m_mask ^= rhs.m_mask; return *this; } // cast operators explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT { return !!m_mask; } explicit VULKAN_HPP_CONSTEXPR operator MaskType() const VULKAN_HPP_NOEXCEPT { return m_mask; } #if defined( VULKAN_HPP_FLAGS_MASK_TYPE_AS_PUBLIC ) public: #else private: #endif MaskType m_mask; }; #if !defined( VULKAN_HPP_HAS_SPACESHIP_OPERATOR ) // relational operators only needed for pre C++20 template VULKAN_HPP_CONSTEXPR bool operator<( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator>( bit ); } template VULKAN_HPP_CONSTEXPR bool operator<=( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator>=( bit ); } template VULKAN_HPP_CONSTEXPR bool operator>( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator<( bit ); } template VULKAN_HPP_CONSTEXPR bool operator>=( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator<=( bit ); } template VULKAN_HPP_CONSTEXPR bool operator==( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator==( bit ); } template VULKAN_HPP_CONSTEXPR bool operator!=( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator!=( bit ); } #endif // bitwise operators template VULKAN_HPP_CONSTEXPR Flags operator&( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator&( bit ); } template VULKAN_HPP_CONSTEXPR Flags operator|( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator|( bit ); } template VULKAN_HPP_CONSTEXPR Flags operator^( BitType bit, Flags const & flags ) VULKAN_HPP_NOEXCEPT { return flags.operator^( bit ); } // bitwise operators on BitType template ::isBitmask, bool>::type = true> VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags operator&(BitType lhs, BitType rhs) VULKAN_HPP_NOEXCEPT { return Flags( lhs ) & rhs; } template ::isBitmask, bool>::type = true> VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags operator|(BitType lhs, BitType rhs) VULKAN_HPP_NOEXCEPT { return Flags( lhs ) | rhs; } template ::isBitmask, bool>::type = true> VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags operator^(BitType lhs, BitType rhs) VULKAN_HPP_NOEXCEPT { return Flags( lhs ) ^ rhs; } template ::isBitmask, bool>::type = true> VULKAN_HPP_INLINE VULKAN_HPP_CONSTEXPR Flags operator~( BitType bit ) VULKAN_HPP_NOEXCEPT { return ~( Flags( bit ) ); }