cubexx::set_base_t

CDEF:

template <typename derived_t, typename element_t, std::size_t N>
struct cubexx::set_base_t

CRTP (curiously recurring template pattern) class for a bit-wise set container, where each element is represented by a 0-based index, and the set internally uses a bit representation for the set implementation.

This is just a base class that has most of the implementation. You probably do not want to ever instantiate this directly.

See
corner_set_t, direction_set_t, edge_set_t, face_set_t.

Public Functions

const_iterator begin() const

Return an iterator to the first element in the set.

const_iterator end() const

Return an invalid iterator that points to one past the last element in the set.

template <typename Sequence>
set_base_t(const Sequence &sequence)

Construct the set from any Sequence.

template <typename LeftIterator, typename RightIterator>
set_base_t(LeftIterator first, RightIterator last)

Constructs the set from the range range [first, last).

set_base_t(const derived_t &set)

Copy constructor.

set_base_t()

Default constructor.

template <typename Sequence>
derived_t &operator=(const Sequence &sequence)

Assignment from any sequence.

derived_t &operator=(const element_t &element)

Assignment from a single element.

derived_t &operator=(const derived_t &set)

Assignment from another set.

template <typename Sequence>
derived_t &operator|=(const Sequence &sequence)

Union with any sequence of elements.

derived_t &operator|=(const derived_t &set)

Union with another set.

derived_t &operator|=(const element_t &element)

Insertion of an element.

template <typename Sequence>
derived_t operator|(const Sequence &sequence) const

Union with any sequence of elements (returns the modified set).

derived_t operator|(const derived_t &set) const

Union with another set (returns the modified set).

derived_t operator|(const element_t &element) const

Insertion of an element (returns the modified set).

template <typename Sequence>
derived_t &operator-=(const Sequence &sequence)

Set difference, with any sequence.

derived_t &operator-=(const derived_t &set)

Set difference.

derived_t &operator-=(const element_t &element)

Erasure of an element from a set.

template <typename Sequence>
derived_t operator-(const Sequence &sequence) const

Set difference, with any sequence (returns the modified set).

derived_t operator-(const derived_t &set) const

Set difference (returns the modified set).

derived_t operator-(const element_t &element) const

Erasure of an element from a set (returns the modified set).

template <typename Sequence>
derived_t &operator&=(const Sequence &sequence)

Set intersection, with any sequence.

derived_t &operator&=(const derived_t &set)

Set intersection.

derived_t &operator&=(const element_t &element)

Set intersection with a single element).

template <typename Sequence>
derived_t operator&(const Sequence &sequence) const

Set intersection, with any sequence (returns the modified set).

derived_t operator&(const derived_t &set) const

Set intersection (returns the modified set).

derived_t operator&(const element_t &element) const

Set intersection with a single element (returns the modified set).

bool contains(const element_t &element) const

Membership test.

bool contains(const std::size_t &idx) const

Membership test, by element index (within its type).

std::size_t size() const

Returns the size of the set.

void clear()

Clears the set.

bool operator==(const derived_t &other) const

Comparison.

bool operator!=(const derived_t &other) const

Comparison.

const std::bitset<N> &bits() const

Return the bit representation of the set; the bit at each element’s index will be set to 1 if the set contains the element, or 0 if the set does not contain the element.

struct cubexx::corner_set_t

Inherits from cubexx::set_base_t< corner_set_t, corner_t, 8 >

struct cubexx::direction_set_t

Inherits from cubexx::set_base_t< direction_set_t, direction_t, 6 >

struct cubexx::edge_set_t

Inherits from cubexx::set_base_t< edge_set_t, edge_t, 12 >

struct cubexx::face_set_t

Inherits from cubexx::set_base_t< face_set_t, face_t, 6 >