Class TypeAttr

Inheritance Relationships

Derived Type

Class Documentation

class TypeAttr

TypeAttr denotes the type of index space.

This class models a host (complete) space partitioned into disjoint subspaces. To simplify implementation of set operations (intersection, union, etc.) it is encoded as a fixed-width (32) bitset.

Subclassed by sequant::IndexSpace::Attr

Public Functions

constexpr TypeAttr() noexcept = default

default ctor creates a null TypeAttr

inline explicit constexpr TypeAttr(bitset_t bitset) noexcept

Constructs from a bitset representation.

Warning

first (most significant) bit is reserved for internal use

Parameters:

bitset – bitset representation of this Type

Pre:

(bitset & make_reserved().bitset) == null.bitset

template<typename T, typename = std::enable_if_t<meta::is_statically_castable_v<std::decay_t<T>, bitset_t> && !std::is_same_v<std::decay_t<T>, bool> && !std::is_same_v<std::decay_t<T>, QuantumNumbersAttr> && !std::is_same_v<std::decay_t<T>, TypeAttr>>>
inline constexpr TypeAttr(T &&value) noexcept

construct TypeAddr from things that can be cast to bitset_t, but exclude bool and QuantumNumbersAttr

inline explicit constexpr operator int64_t() const
inline explicit constexpr operator bitset_t() const
inline constexpr int32_t to_int32() const
inline explicit constexpr operator bool() const
Returns:

true if this object is non-null (i.e. has any bits set)

inline constexpr TypeAttr(const TypeAttr &other)
inline constexpr TypeAttr unIon(TypeAttr other) const

Note

equivalent to this->to_int32() | other.to_int32()

Returns:

union of *this and other, i.e. *this AND other

inline constexpr const TypeAttr xOr(TypeAttr other) const

Note

equivalent to this->to_int32() ^ other.to_int32()

Returns:

*this XOR other

inline constexpr const TypeAttr intersection(TypeAttr other) const

Note

equivalent to this->to_int32() & other.to_int32()

Returns:

intersection of *this AND other

inline constexpr TypeAttr operator~() const

Note

equivalent to ~this->to_int32()

Returns:

complement of *this

inline constexpr bool includes(TypeAttr other) const
Returns:

true if other is included in this object

Public Static Attributes

static const TypeAttr null

the null TypeAttr

Friends

inline friend constexpr TypeAttr operator|(const TypeAttr a, const TypeAttr b)
Returns:

union of a and b, i.e. a AND b

inline friend constexpr TypeAttr operator^(const TypeAttr a, const TypeAttr b)
Returns:

a XOR b

inline friend constexpr TypeAttr operator&(const TypeAttr a, const TypeAttr b)
Returns:

intersection of a AND b

inline friend constexpr bool operator==(const TypeAttr lhs, const TypeAttr rhs)
inline friend constexpr bool operator!=(const TypeAttr lhs, const TypeAttr rhs)
inline friend constexpr bool operator<(TypeAttr a, TypeAttr b)
Returns:

true if in canonical order this object preceeds other