Skip to main content

magic_enum::containers

C++ API reference for the namespace magic_enum::containers.

Public API

Class: bitset

Canonical path: magic_enum::containers::bitset

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

class bitset {};

Summary

A template class representing a set of bits indexed by an enum.

Class: set

Canonical path: magic_enum::containers::set

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

class set {};

Summary

A template class representing a set of enum values.

Constructor: bitset

Canonical path: magic_enum::containers::bitset::bitset

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr explicit bitset(detail::raw_access_t = raw_access) noexcept;

Summary

Constructs an empty bitset.

Behavior

Initializes the internal storage to an empty state.

Overload 2
constexpr explicit bitset(detail::raw_access_t, const char_type* str, std::size_t n = ~std::size_t{0}, char_type zero = static_cast<char_type>('0'), char_type one = static_cast<char_type>('1'));

Summary

Constructs a bitset from a character string.

Behavior

Constructs a bitset from a character string by delegating to the string_view constructor.

Parameters

  • Parameter 1: A tag indicating raw access.
  • str: The character string to parse.
Overload 3
constexpr explicit bitset(detail::raw_access_t, string_view sv, string_view::size_type pos = 0, string_view::size_type n = string_view::npos, char_type zero = static_cast<char_type>('0'), char_type one = static_cast<char_type>('1'));

Summary

Constructs a bitset from a string view.

Behavior

Constructs a bitset from a string_view. It iterates through the substring and sets bits where the character matches the 'one' character. It throws std::out_of_range if the index exceeds the enum count and std::invalid_argument for unrecognized characters.

Parameters

  • Parameter 1: A tag indicating raw access.
  • sv: The string view to parse.
Overload 4
constexpr explicit bitset(detail::raw_access_t, unsigned long long val);

Summary

Constructs a bitset from a numeric value.

Behavior

Constructs a bitset from an unsigned long long value. It iterates through the bits of the value and sets the corresponding bit in the bitset. It throws std::out_of_range if a bit index exceeds the enum count.

Parameters

  • Parameter 1: A tag indicating raw access.
  • val: The numeric value to convert to a bitset.
Overload 5
constexpr explicit bitset(V starter);

Summary

Constructs a bitset from a flag enum.

Behavior

Constructs a bitset from a flag enum value. It iterates through all enum values and sets the bit if the flag is present in the starter value. It throws std::invalid_argument if there are unrecognized bits remaining in the starter.

Parameters

  • starter: The initial flag enum value.
Overload 6
constexpr bitset(std::initializer_list<E> starters);

Summary

Constructs a bitset from an initializer list.

Behavior

Constructs a bitset from an initializer list of enum values. If the enum type represents flags, it performs a bitwise OR with each element. Otherwise, it calls set() for each element.

Parameters

  • starters: The list of enum values to set.
Overload 7
constexpr explicit bitset(string_view sv, Cmp&& cmp = {}, char_type sep = static_cast<char_type>('|'));

Summary

Constructs a bitset from a delimited string of enum names.

Behavior

Constructs a bitset by parsing a string_view containing enum names separated by a delimiter. It uses enum_cast to convert substrings to enum values and calls set() for each. It throws std::invalid_argument if a substring cannot be cast to a valid enum value.

Parameters

  • sv: The string view containing delimited enum names.

Constructor: set

Canonical path: magic_enum::containers::set::set

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr set() noexcept = default;

Summary

Default constructor for the set.

Behavior

Constructs an empty set using the default implementation.

Overload 2
constexpr set(set&&) noexcept = default;

Summary

Move constructor for the set.

Behavior

Constructs a new set by moving the contents from another set using the default implementation.

Parameters

  • Parameter 1: The set instance to move from.
Overload 3
constexpr set(const set&) noexcept = default;

Summary

Copy constructor for the set.

Behavior

Constructs a new set by copying the contents from another set using the default implementation.

Parameters

  • Parameter 1: The set instance to copy from.
Overload 4
constexpr set(InputIt first, InputIt last);

Summary

Constructs a set from a range of elements.

Behavior

Constructs a set by iterating from the first iterator to the last and inserting each dereferenced element.

Parameters

  • first: The beginning of the range to copy elements from.
  • last: The end of the range to copy elements from.
Overload 5
constexpr set(std::initializer_list<E> ilist);

Summary

Constructs a set from an initializer list.

Behavior

Constructs a set by iterating through the provided initializer list and inserting each element.

Parameters

  • ilist: The initializer list containing elements to populate the set.
Overload 6
constexpr explicit set(V starter);

Summary

Constructs a set from a flags-style enum value.

Behavior

Constructs a set from a flags-style enum value by checking the bitwise AND of the underlying value of each enum member against the starter value.

Parameters

  • starter: The initial flags-style enum value used to determine which elements to insert.

Free Function: bitset

Canonical path: magic_enum::containers::bitset

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

explicit bitset(V starter) -> bitset<V>;

Parameters

  • starter: The initial value used to construct the bitset.

Returns

  • Return value 1: A new bitset instance.

Free Function: get

Canonical path: magic_enum::containers::get

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr std::enable_if_t<(std::is_integral_v<decltype(I)> && I < enum_count<E>()), const V&&> get(const array<E, V, Index>&& a) noexcept;
Overload 2
constexpr std::enable_if_t<(std::is_integral_v<decltype(I)> && I < enum_count<E>()), const V&> get(const array<E, V, Index>& a) noexcept;

Free Function: make_array

Canonical path: magic_enum::containers::make_array

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr std::enable_if_t<(enum_count<E>() == sizeof...(Ts)), array<E, std::remove_cv_t<std::common_type_t<Ts...>>>> make_array(Ts&&... ts);

Summary

Creates a magic_enum::containers::array from a list of arguments.

Behavior

Constructs an array by forwarding the provided arguments into an initializer list.

Returns

  • Return value 1: An array containing the forwarded elements, provided the number of arguments matches the enum count.

Free Function: set

Canonical path: magic_enum::containers::set

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

explicit set(V starter) -> set<V>;

Parameters

  • starter: The initial value used to construct the set.

Returns

  • Return value 1: A new set instance.

Free Function: to_array

Canonical path: magic_enum::containers::to_array

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr std::enable_if_t<(enum_count<E>() == N), array<E, std::remove_cv_t<T>>> to_array(T(&&a)[N]);

Summary

Converts an rvalue C-style array to a magic_enum::containers::array.

Behavior

Moves the elements of the input array into a new magic_enum::containers::array using an internal implementation helper.

Parameters

  • a: An rvalue reference to a C-style array.

Returns

  • Return value 1: A magic_enum::containers::array containing the moved elements.
Overload 2
constexpr std::enable_if_t<(enum_count<E>() == N), array<E, std::remove_cv_t<T>>> to_array(T (&a)[N]);

Summary

Converts a C-style array to a magic_enum::containers::array.

Behavior

Copies the elements of the input array into a new magic_enum::containers::array using an internal implementation helper.

Parameters

  • a: A reference to a C-style array.

Returns

  • Return value 1: A magic_enum::containers::array containing the copied elements.

Member Function: at

Canonical path: magic_enum::containers::array::at

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr const_reference at(E pos) const;

Summary

Provides bounds-checked access to the array elements.

Behavior

Retrieves the element at the specified enum position, throwing std::out_of_range if the position is unrecognized.

Parameters

  • pos: The enum position to access.

Returns

  • Return value 1: A constant reference to the element at the specified position.
Overload 2
constexpr reference at(E pos);

Summary

Provides bounds-checked access to the array elements.

Behavior

Retrieves the element at the specified enum position, throwing std::out_of_range if the position is unrecognized.

Parameters

  • pos: The enum position to access.

Returns

  • Return value 1: A reference to the element at the specified position.

Member Function: back

Canonical path: magic_enum::containers::array::back

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_reference back() const noexcept;

Summary

Accesses the last element of the array.

Behavior

Returns the last element of the underlying array.

Returns

  • Return value 1: A constant reference to the last element.
Overload 2
[[nodiscard]] constexpr reference back() noexcept;

Summary

Accesses the last element of the array.

Behavior

Returns the last element of the underlying array.

Returns

  • Return value 1: A reference to the last element.

Member Function: begin

Canonical path: magic_enum::containers::array::begin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator begin() const noexcept;

Summary

Returns a constant iterator to the beginning of the array.

Behavior

Returns an iterator to the first element of the underlying array.

Returns

  • Return value 1: A constant iterator to the beginning.
Overload 2
[[nodiscard]] constexpr iterator begin() noexcept;

Summary

Returns an iterator to the beginning of the array.

Behavior

Returns an iterator to the first element of the underlying array.

Returns

  • Return value 1: An iterator to the beginning.

Member Function: cbegin

Canonical path: magic_enum::containers::array::cbegin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr const_iterator cbegin() const noexcept;

Summary

Returns a constant iterator to the beginning of the array.

Behavior

This method returns a constant iterator to the beginning of the underlying array.

Returns

  • Return value 1: A constant iterator to the first element.

Member Function: cend

Canonical path: magic_enum::containers::array::cend

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr const_iterator cend() const noexcept;

Summary

Returns a constant iterator to the end of the array.

Behavior

This method returns a constant iterator to the end of the underlying array.

Returns

  • Return value 1: A constant iterator to the element following the last element.

Member Function: crbegin

Canonical path: magic_enum::containers::array::crbegin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr const_iterator crbegin() const noexcept;

Summary

Returns a constant reverse iterator to the beginning.

Behavior

This method returns a constant reverse iterator to the first element of the reversed array.

Returns

  • Return value 1: A constant reverse iterator to the beginning.

Member Function: crend

Canonical path: magic_enum::containers::array::crend

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr const_iterator crend() const noexcept;

Summary

Returns a constant reverse iterator to the end.

Behavior

This method returns a constant reverse iterator to the element following the last element of the reversed array.

Returns

  • Return value 1: A constant reverse iterator to the end.

Member Function: data

Canonical path: magic_enum::containers::array::data

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_pointer data() const noexcept;

Summary

Returns a constant pointer to the underlying data.

Behavior

This method returns a constant pointer to the underlying data.

Returns

  • Return value 1: A constant pointer to the first element in the array.
Overload 2
[[nodiscard]] constexpr pointer data() noexcept;

Summary

Returns a pointer to the underlying data.

Behavior

This method returns a pointer to the underlying data.

Returns

  • Return value 1: A pointer to the first element in the array.

Member Function: empty

Canonical path: magic_enum::containers::array::empty

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr bool empty() const noexcept;

Summary

Checks whether the array is empty.

Behavior

This method checks if the underlying array is empty.

Returns

  • Return value 1: True if the array is empty, false otherwise.

Member Function: end

Canonical path: magic_enum::containers::array::end

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator end() const noexcept;

Summary

Returns a constant iterator to the end.

Behavior

This method returns a constant iterator to the end of the underlying array.

Returns

  • Return value 1: A constant iterator to the element following the last element.
Overload 2
[[nodiscard]] constexpr iterator end() noexcept;

Summary

Returns an iterator to the end.

Behavior

This method returns an iterator to the end of the underlying array.

Returns

  • Return value 1: An iterator to the element following the last element.

Member Function: fill

Canonical path: magic_enum::containers::array::fill

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr void fill(const V& value);

Summary

Fills the array with a specific value.

Behavior

This method assigns the specified value to every element in the array by iterating through it.

Parameters

  • value: The value to be assigned to all elements in the array.

Member Function: front

Canonical path: magic_enum::containers::array::front

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_reference front() const noexcept;

Summary

Returns a constant reference to the first element.

Behavior

This method returns a constant reference to the first element of the underlying array.

Returns

  • Return value 1: A constant reference to the first element.
Overload 2
[[nodiscard]] constexpr reference front() noexcept;

Summary

Returns a reference to the first element.

Behavior

This method returns a reference to the first element of the underlying array.

Returns

  • Return value 1: A reference to the first element.

Member Function: max_size

Canonical path: magic_enum::containers::array::max_size

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr size_type max_size() const noexcept;

Summary

Returns the maximum size of the array.

Behavior

This method returns the maximum number of elements the array can hold.

Returns

  • Return value 1: The maximum number of elements.

Member Function: operator!=

Canonical path: magic_enum::containers::array::operator!=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator!=(const array& a1, const array& a2);

Summary

Checks if two arrays are not equal.

Behavior

This operator checks if two arrays are not equal by negating the result of an equality check.

Parameters

  • a1: The first array to compare.
  • a2: The second array to compare.

Returns

  • Return value 1: True if the arrays are not equal, false otherwise.

Member Function: operator<

Canonical path: magic_enum::containers::array::operator<

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator<(const array& a1, const array& a2);

Summary

Checks if the first array is less than the second.

Behavior

This operator performs a lexicographical comparison to determine if the first array is less than the second.

Parameters

  • a1: The first array to compare.
  • a2: The second array to compare.

Returns

  • Return value 1: True if the first array is lexicographically less than the second, false otherwise.

Member Function: operator<=

Canonical path: magic_enum::containers::array::operator<=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator<=(const array& a1, const array& a2);

Summary

Checks if the first array is less than or equal to the second.

Behavior

This operator checks if the first array is less than or equal to the second by negating a lexicographical comparison of the second against the first.

Parameters

  • a1: The first array to compare.
  • a2: The second array to compare.

Returns

  • Return value 1: True if the first array is less than or equal to the second, false otherwise.

Member Function: operator==

Canonical path: magic_enum::containers::array::operator==

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator==(const array& a1, const array& a2);

Summary

Checks if two arrays are equal.

Behavior

This operator checks if two arrays are equal using a detail equality helper.

Parameters

  • a1: The first array to compare.
  • a2: The second array to compare.

Returns

  • Return value 1: True if the arrays are equal, false otherwise.

Member Function: operator>

Canonical path: magic_enum::containers::array::operator>

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator>(const array& a1, const array& a2);

Summary

Checks if the first array is greater than the second.

Behavior

This operator performs a lexicographical comparison to determine if the first array is greater than the second.

Parameters

  • a1: The first array to compare.
  • a2: The second array to compare.

Returns

  • Return value 1: True if the first array is lexicographically greater than the second, false otherwise.

Member Function: operator>=

Canonical path: magic_enum::containers::array::operator>=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator>=(const array& a1, const array& a2);

Summary

Checks if the first array is greater than or equal to the second.

Behavior

This operator checks if the first array is greater than or equal to the second by negating a lexicographical comparison of the first against the second.

Parameters

  • a1: The first array to compare.
  • a2: The second array to compare.

Returns

  • Return value 1: True if the first array is greater than or equal to the second, false otherwise.

Member Function: operator[]

Canonical path: magic_enum::containers::array::operator[]

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_reference operator[](E pos) const;

Summary

Accesses the element at the specified position.

Behavior

This operator retrieves the index for the given position, asserts its validity, and returns a constant reference to the element at that index.

Parameters

  • pos: The position of the element to access.

Returns

  • Return value 1: A constant reference to the element at the specified position.
Overload 2
[[nodiscard]] constexpr reference operator[](E pos);

Summary

Provides access to the element at the given position.

Behavior

Accesses the element at the specified position after validating the index with MAGIC_ENUM_ASSERT.

Parameters

  • pos: The position of the element to access.

Returns

  • Return value 1: A reference to the element at the specified position.

Member Function: rbegin

Canonical path: magic_enum::containers::array::rbegin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator rbegin() const noexcept;

Summary

Returns a constant reverse iterator to the beginning.

Behavior

Returns a constant reverse iterator to the first element of the reversed array.

Returns

  • Return value 1: A constant reverse iterator to the beginning of the reversed array.
Overload 2
[[nodiscard]] constexpr iterator rbegin() noexcept;

Summary

Returns a reverse iterator to the beginning.

Behavior

Returns a reverse iterator to the first element of the reversed array.

Returns

  • Return value 1: A reverse iterator to the beginning of the reversed array.

Member Function: rend

Canonical path: magic_enum::containers::array::rend

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator rend() const noexcept;

Summary

Returns a constant reverse iterator to the end.

Behavior

Returns a constant reverse iterator to the element following the last element of the reversed array.

Returns

  • Return value 1: A constant reverse iterator to the end of the reversed array.
Overload 2
[[nodiscard]] constexpr iterator rend() noexcept;

Summary

Returns a reverse iterator to the end.

Behavior

Returns a reverse iterator to the element following the last element of the reversed array.

Returns

  • Return value 1: A reverse iterator to the end of the reversed array.

Member Function: size

Canonical path: magic_enum::containers::array::size

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr size_type size() const noexcept;

Summary

Returns the size of the array.

Behavior

Returns the number of elements in the array.

Returns

  • Return value 1: The number of elements.

Member Function: swap

Canonical path: magic_enum::containers::array::swap

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr void swap(array& other) noexcept(std::is_nothrow_swappable_v<V>);

Summary

Swaps the contents with another array.

Behavior

Swaps the contents of the array with another array by moving each element.

Parameters

  • other: The other array to swap contents with.

Member Function: all

Canonical path: magic_enum::containers::bitset::all

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr bool all() const noexcept;

Summary

Checks if all bits are set.

Behavior

Checks if all bits are set. If the bitset is empty, it returns true. For non-empty bitsets, it iterates through the base types and checks if all bits are set, accounting for bits that are not of interest.

Returns

  • Return value 1: True if all bits are set, false otherwise.

Member Function: any

Canonical path: magic_enum::containers::bitset::any

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr bool any() const noexcept;

Summary

Checks if any bit is set.

Behavior

Iterates through the internal storage and returns true if any element is greater than zero.

Returns

  • Return value 1: True if any bit is set, false otherwise.

Member Function: count

Canonical path: magic_enum::containers::bitset::count

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr std::size_t count() const noexcept;

Summary

Returns the number of set bits.

Behavior

Calculates the total number of set bits by summing the popcount of each internal storage element.

Returns

  • Return value 1: The number of set bits.

Member Function: flip

Canonical path: magic_enum::containers::bitset::flip

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr bitset& flip() noexcept;

Summary

Flips all bits.

Behavior

Flips all bits in the bitset by applying a bitwise NOT to the current object.

Returns

  • Return value 1: A reference to the modified bitset.

Member Function: max_size

Canonical path: magic_enum::containers::bitset::max_size

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr std::size_t max_size() const noexcept;

Summary

Returns the maximum size of the bitset.

Behavior

Returns the maximum number of bits the bitset can hold, which corresponds to the enum count.

Returns

  • Return value 1: The maximum number of bits.

Member Function: none

Canonical path: magic_enum::containers::bitset::none

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr bool none() const noexcept;

Summary

Checks if no bits are set.

Behavior

Checks if none of the bits are set by returning the logical negation of any().

Returns

  • Return value 1: Returns true if no bits are set, false otherwise.

Member Function: operator std::enable_if_t<magic_enum::detail::subtype_v<V> == magic_enum::detail::enum_subtype::flags, E>

Canonical path: magic_enum::containers::bitset::operator std::enable_if_t<magic_enum::detail::subtype_v<V> == magic_enum::detail::enum_subtype::flags, E>

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr explicit operator std::enable_if_t<magic_enum::detail::subtype_v<V> == magic_enum::detail::enum_subtype::flags, E>() const;

Summary

Explicitly converts the bitset to its underlying enum type if the subtype is flags.

Behavior

Iterates through all enum values of type E and performs a bitwise OR operation on those that satisfy the test condition.

Returns

  • Return value 1: Returns the resulting enum value containing the combined flags.

Member Function: operator!=

Canonical path: magic_enum::containers::bitset::operator!=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator!=(const bitset& lhs, const bitset& rhs) noexcept;

Summary

Compares two bitsets for inequality.

Behavior

Determines inequality by negating the result of a detail::equal comparison between the internal arrays of two bitsets.

Parameters

  • lhs: The left-hand side bitset to compare.
  • rhs: The right-hand side bitset to compare.

Returns

  • Return value 1: Returns true if the bitsets are not equal, false otherwise.

Member Function: operator&

Canonical path: magic_enum::containers::bitset::operator&

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bitset operator&(const bitset& lhs, const bitset& rhs) noexcept;

Summary

Performs a bitwise AND operation between two bitsets.

Behavior

Creates a copy of the left-hand side bitset and applies the bitwise AND assignment operator with the right-hand side bitset.

Parameters

  • lhs: The first bitset operand.
  • rhs: The second bitset operand.

Returns

  • Return value 1: Returns a new bitset representing the bitwise AND of the two operands.

Member Function: operator&=

Canonical path: magic_enum::containers::bitset::operator&=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr bitset& operator&=(const bitset& other) noexcept;

Summary

Performs a bitwise AND assignment.

Behavior

Performs a bitwise AND operation between each element of the internal array and the corresponding element in the other bitset.

Parameters

  • other: The bitset to perform the bitwise AND with.

Returns

  • Return value 1: Returns a reference to this bitset.

Member Function: operator<<

Canonical path: magic_enum::containers::bitset::operator<<

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

std::ostream& operator<<(std::ostream& o, const bitset& bs);

Summary

Inserts a string representation of the bitset into an output stream.

Behavior

Converts the bitset to its string representation and inserts it into the output stream.

Parameters

  • o: The output stream to write to.
  • bs: The bitset to be written.

Returns

  • Return value 1: Returns a reference to the output stream.

Member Function: operator==

Canonical path: magic_enum::containers::bitset::operator==

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bool operator==(const bitset& lhs, const bitset& rhs) noexcept;

Summary

Compares two bitsets for equality.

Behavior

Compares the internal arrays of two bitsets using detail::equal.

Parameters

  • lhs: The left-hand side bitset to compare.
  • rhs: The right-hand side bitset to compare.

Returns

  • Return value 1: Returns true if the bitsets are equal, false otherwise.

Member Function: operator>>

Canonical path: magic_enum::containers::bitset::operator>>

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

std::istream& operator>>(std::istream& i, bitset& bs);

Summary

Extracts a bitset from an input stream.

Behavior

Reads a string from the input stream and, if the string is not empty, constructs a new bitset from it and assigns it to bs.

Parameters

  • i: The input stream to read from.
  • bs: The bitset to be populated.

Returns

  • Return value 1: Returns a reference to the input stream.

Member Function: operator[]

Canonical path: magic_enum::containers::bitset::operator[]

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr bool operator[](E pos) const;

Summary

Accesses the bit at the specified position.

Behavior

Retrieves the index for the specified enum position and returns the bit value at that index as a boolean.

Parameters

  • pos: The enum value representing the bit position to access.

Returns

  • Return value 1: Returns the value of the bit at the specified position.
Overload 2
[[nodiscard]] constexpr reference operator[](E pos);

Summary

Accesses the bit at the specified position.

Behavior

Retrieves the index for the specified enum position and returns a reference object to the bit at that index.

Parameters

  • pos: The enum value representing the bit position to access.

Returns

  • Return value 1: Returns a reference to the bit at the specified position.

Member Function: operator^

Canonical path: magic_enum::containers::bitset::operator^

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bitset operator^(const bitset& lhs, const bitset& rhs) noexcept;

Summary

Performs a bitwise XOR operation between two bitsets.

Behavior

Creates a copy of the left-hand side bitset and applies the bitwise XOR assignment operator with the right-hand side bitset.

Parameters

  • lhs: The first bitset operand.
  • rhs: The second bitset operand.

Returns

  • Return value 1: Returns a new bitset representing the bitwise XOR of the two operands.

Member Function: operator^=

Canonical path: magic_enum::containers::bitset::operator^=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr bitset& operator^=(const bitset& other) noexcept;

Summary

Performs a bitwise XOR assignment.

Behavior

Performs a bitwise XOR operation between each element of the internal array and the corresponding element in the other bitset.

Parameters

  • other: The bitset to perform the bitwise XOR with.

Returns

  • Return value 1: Returns a reference to this bitset.

Member Function: operator|

Canonical path: magic_enum::containers::bitset::operator|

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] friend constexpr bitset operator|(const bitset& lhs, const bitset& rhs) noexcept;

Summary

Performs a bitwise OR operation between two bitsets.

Behavior

Creates a copy of the left-hand side bitset and applies the bitwise OR assignment operator with the right-hand side bitset.

Parameters

  • lhs: The first bitset operand.
  • rhs: The second bitset operand.

Returns

  • Return value 1: Returns a new bitset representing the bitwise OR of the two operands.

Member Function: operator|=

Canonical path: magic_enum::containers::bitset::operator|=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr bitset& operator|=(const bitset& other) noexcept;

Summary

Performs a bitwise OR assignment.

Behavior

Performs a bitwise OR operation between each element of the internal array and the corresponding element in the other bitset.

Parameters

  • other: The bitset to perform the bitwise OR with.

Returns

  • Return value 1: Returns a reference to this bitset.

Member Function: operator~

Canonical path: magic_enum::containers::bitset::operator~

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr bitset operator~() const noexcept;

Summary

Performs a bitwise NOT operation.

Behavior

Inverts all bits in the bitset, ensuring that bits beyond the last valid value are masked out if necessary.

Returns

  • Return value 1: Returns a new bitset with all bits inverted.

Member Function: reset

Canonical path: magic_enum::containers::bitset::reset

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr bitset& reset() noexcept;

Summary

Resets all bits to false.

Behavior

Resets all bits in the bitset by assigning a default-constructed bitset to the current instance.

Returns

  • Return value 1: Returns a reference to this bitset.
Overload 2
constexpr bitset& reset(E pos);

Summary

Resets the bit at the specified position to false.

Behavior

Sets the bit at the specified enum position to false. Throws std::out_of_range if the position is unrecognized.

Parameters

  • pos: The enum value representing the bit position to reset.

Returns

  • Return value 1: Returns a reference to this bitset.

Member Function: set

Canonical path: magic_enum::containers::bitset::set

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr bitset& set() noexcept;

Summary

Sets all bits to true.

Behavior

Sets all bits in the internal array to true, applying a mask to the last element if there are unused bits.

Returns

  • Return value 1: Returns a reference to this bitset.
Overload 2
constexpr bitset& set(E pos, bool value = true);

Summary

Sets the bit at a specific position to a boolean value.

Behavior

Sets the bit at the specified position to the given value, or throws std::out_of_range if the position is unrecognized.

Parameters

  • pos: The position of the bit to set.

Returns

  • Return value 1: A reference to the bitset object.

Member Function: size

Canonical path: magic_enum::containers::bitset::size

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr std::size_t size() const noexcept;

Summary

Returns the number of elements in the bitset.

Behavior

Calculates the size by calling enum_count for the template type E.

Returns

  • Return value 1: The number of elements in the enum.

Member Function: test

Canonical path: magic_enum::containers::bitset::test

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr bool test(E pos) const;

Summary

Tests whether a specific bit is set.

Behavior

Checks if the bit at the specified position is set, throwing std::out_of_range if the position is invalid.

Parameters

  • pos: The position of the bit to test.

Returns

  • Return value 1: True if the bit at the specified position is set, false otherwise.

Member Function: to_string

Canonical path: magic_enum::containers::bitset::to_string

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] string to_string(char_type sep = static_cast<char_type>('|')) const;

Summary

Converts the bitset to a string of enum names.

Behavior

Iterates through enum values and appends the names of set bits to a string, separated by the specified character.

Returns

  • Return value 1: A string representation of the set bits.
Overload 2
[[nodiscard]] string to_string(detail::raw_access_t, char_type zero = static_cast<char_type>('0'), char_type one = static_cast<char_type>('1')) const;

Summary

Returns a raw string representation of the bitset using specified characters for set and unset bits.

Behavior

Constructs a string by appending the 'one' character for set bits and the 'zero' character for unset bits across the entire size of the bitset.

Parameters

  • Parameter 1: The characters to use for zero and one values, and a raw access tag.

Returns

  • Return value 1: A string of characters representing the raw bit states.

Member Function: to_ullong

Canonical path: magic_enum::containers::bitset::to_ullong

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr unsigned long long to_ullong(detail::raw_access_t raw) const;

Summary

Converts the bitset to an unsigned long long.

Behavior

Invokes the internal to_ template function with unsigned long long.

Parameters

  • raw: A tag indicating raw access.

Returns

  • Return value 1: The bitset value as an unsigned long long.

Member Function: to_ulong

Canonical path: magic_enum::containers::bitset::to_ulong

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr unsigned long long to_ulong(detail::raw_access_t raw) const;

Summary

Converts the bitset to an unsigned long.

Behavior

Invokes the internal to_ template function with unsigned long.

Parameters

  • raw: A tag indicating raw access.

Returns

  • Return value 1: The bitset value as an unsigned long.

Member Function: begin

Canonical path: magic_enum::containers::set::begin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_iterator begin() const noexcept;

Summary

Returns a constant iterator to the beginning.

Behavior

Constructs and returns a const_iterator initialized with the current object and the start and end of the index type.

Returns

  • Return value 1: A constant iterator to the beginning of the set.

Member Function: cbegin

Canonical path: magic_enum::containers::set::cbegin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_iterator cbegin() const noexcept;

Summary

Returns a constant iterator to the beginning.

Behavior

Calls the begin() method to retrieve the starting iterator.

Returns

  • Return value 1: A constant iterator to the beginning of the set.

Member Function: cend

Canonical path: magic_enum::containers::set::cend

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_iterator cend() const noexcept;

Summary

Returns a constant iterator to the end.

Behavior

Calls the end() method to retrieve the termination iterator.

Returns

  • Return value 1: A constant iterator to the end of the set.

Member Function: clear

Canonical path: magic_enum::containers::set::clear

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr void clear() noexcept;

Summary

Removes all elements from the set.

Behavior

Resets the underlying bitset and sets the size counter to zero.

Member Function: contains

Canonical path: magic_enum::containers::set::contains

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr bool contains(const key_type& key) const noexcept;

Summary

Checks if the set contains the specified key.

Behavior

Checks for the presence of a key by calling the count method.

Parameters

  • key: The key to search for.

Returns

  • Return value 1: True if the key is found, false otherwise.
Overload 2
[[nodiscard]] constexpr std::enable_if_t<detail::is_transparent_v<KC>, bool> contains(const K& x) const noexcept;

Summary

Checks if the set contains an element equivalent to the provided value.

Behavior

Determines if an element exists by checking if the count of the provided value is greater than zero.

Parameters

  • x: The value to search for.

Returns

  • Return value 1: True if the element is present, false otherwise.

Member Function: count

Canonical path: magic_enum::containers::set::count

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr size_type count(const key_type& key) const noexcept;

Summary

Returns the number of elements matching the specific key.

Behavior

Verifies if the key exists in the index type and is set in the underlying bitset.

Parameters

  • key: The key to count.

Returns

  • Return value 1: The number of occurrences of the key, which is either 0 or 1.
Overload 2
[[nodiscard]] constexpr std::enable_if_t<detail::is_transparent_v<KC>, size_type> count(const K& x) const;

Summary

Returns the number of elements matching a value using a transparent comparator.

Behavior

Iterates through the equal range of the provided value and sums the counts of each element found.

Parameters

  • x: The value to count.

Returns

  • Return value 1: The total number of elements matching the value.

Member Function: crbegin

Canonical path: magic_enum::containers::set::crbegin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_reverse_iterator crbegin() const noexcept;

Summary

Returns a constant reverse iterator to the beginning.

Behavior

Calls the rbegin() method to retrieve the starting reverse iterator.

Returns

  • Return value 1: A constant reverse iterator to the beginning.

Member Function: crend

Canonical path: magic_enum::containers::set::crend

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_reverse_iterator crend() const noexcept;

Summary

Returns a constant reverse iterator to the end.

Behavior

Calls the rend() method to retrieve the termination reverse iterator.

Returns

  • Return value 1: A constant reverse iterator to the end.

Member Function: emplace

Canonical path: magic_enum::containers::set::emplace

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr std::pair<iterator, bool> emplace(Args&&... args) noexcept;

Summary

Inserts a new element constructed in-place.

Behavior

Forwards the arguments to the insert method to add a new element.

Returns

  • Return value 1: A pair containing an iterator to the element and a boolean indicating if insertion took place.

Member Function: emplace_hint

Canonical path: magic_enum::containers::set::emplace_hint

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr iterator emplace_hint(const_iterator, Args&&... args) noexcept;

Summary

Inserts an element with a placement hint.

Behavior

Inserts a new element into the set using the provided arguments and returns the iterator to the element.

Parameters

  • Parameter 1: A constant iterator hint and the arguments for construction.

Returns

  • Return value 1: An iterator to the inserted element.

Member Function: empty

Canonical path: magic_enum::containers::set::empty

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr bool empty() const noexcept;

Summary

Checks whether the set contains no elements.

Behavior

Checks if the internal size counter is equal to zero.

Returns

  • Return value 1: True if the set is empty, false otherwise.

Member Function: end

Canonical path: magic_enum::containers::set::end

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_iterator end() const noexcept;

Summary

Returns a constant iterator to the end.

Behavior

Returns a constant iterator to the element following the last element of the set.

Returns

  • Return value 1: A constant iterator to the end of the container.

Member Function: equal_range

Canonical path: magic_enum::containers::set::equal_range

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr std::pair<const_iterator, const_iterator> equal_range(const key_type& key) const noexcept;

Summary

Returns a range containing all elements with a given key.

Behavior

Finds the range of elements matching a specific key by calling lower_bound and upper_bound.

Parameters

  • key: The key value to compare elements against.

Returns

  • Return value 1: A pair of constant iterators defining the range of elements that match the key.
Overload 2
[[nodiscard]] constexpr std::enable_if_t<detail::is_transparent_v<KC>, std::pair<const_iterator, const_iterator>> equal_range(const K& x) const noexcept;

Summary

Returns a range of elements matching a value using transparent comparison.

Behavior

Finds the range of elements matching a value x using transparent comparison, provided the comparator is transparent.

Parameters

  • x: The value to compare elements against.

Returns

  • Return value 1: A pair of constant iterators defining the range of elements matching x.

Member Function: erase

Canonical path: magic_enum::containers::set::erase

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr iterator erase(const_iterator first, const_iterator last) noexcept;

Summary

Erases a range of elements.

Behavior

Removes elements in the range [first, last) by repeatedly calling erase on the first iterator until the last iterator is reached.

Parameters

  • first: The beginning of the range to erase.
  • last: The end of the range to erase.

Returns

  • Return value 1: An iterator to the element following the last removed element.
Overload 2
constexpr size_type erase(const key_type& key) noexcept;

Summary

Erases the element with the specified key.

Behavior

Checks if the key exists in the container; if it does, it decrements the internal size counter and sets the element reference to false.

Parameters

  • key: The key of the element to remove.

Returns

  • Return value 1: Returns 1 if an element was removed, and 0 otherwise.
Overload 3
constexpr iterator erase(const_iterator pos) noexcept;

Summary

Erases the element at a specific position.

Behavior

Removes the element at the specified iterator position by calling erase with the dereferenced iterator value.

Parameters

  • pos: The position of the element to erase.

Returns

  • Return value 1: An iterator to the element following the erased element.
Overload 4
constexpr std::enable_if_t<detail::is_transparent_v<KC>, size_type> erase(K&& x) noexcept;

Summary

Erases elements matching a value using transparent comparison.

Behavior

Finds the range of elements matching x using a transparent comparator and erases each element in that range.

Parameters

  • x: The value to match for erasure.

Returns

  • Return value 1: The total number of elements erased.

Member Function: erase_if

Canonical path: magic_enum::containers::set::erase_if

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

size_type erase_if(Pred pred);

Summary

Erases all elements that satisfy a predicate.

Behavior

Iterates through the container from beginning to end and erases every element for which the predicate returns true.

Parameters

  • pred: A unary predicate which returns true if the element should be removed.

Returns

  • Return value 1: The number of elements removed from the container.

Member Function: find

Canonical path: magic_enum::containers::set::find

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator find(const key_type& key) const noexcept;

Summary

Finds an element with a specific key.

Behavior

Checks if the key exists in the container and returns an iterator to it if found; otherwise, returns the end iterator.

Parameters

  • key: The key to search for.

Returns

  • Return value 1: A constant iterator to the element if found, otherwise end().
Overload 2
[[nodiscard]] constexpr std::enable_if_t<detail::is_transparent_v<KC>, const_iterator> find(const K& x) const;

Summary

Finds an element matching a value using transparent comparison.

Behavior

Iterates through the range of elements matching x and returns an iterator to the first one that exists in the container.

Parameters

  • x: The value to search for.

Returns

  • Return value 1: A constant iterator to the first matching element, or end() if no match is found.

Member Function: insert

Canonical path: magic_enum::containers::set::insert

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr iterator insert(const_iterator, const value_type& value) noexcept;

Summary

Inserts a value with a hint.

Behavior

Inserts the value into the set and returns an iterator to the inserted or existing element, ignoring the provided hint.

Parameters

  • Parameter 1: An iterator used as a hint for where to start the search (unused).
  • value: The value to insert.

Returns

  • Return value 1: An iterator to the inserted element or the element that prevented insertion.
Overload 2
constexpr void insert(InputIt first, InputIt last) noexcept;

Summary

Inserts a range of elements.

Behavior

Iterates through the range [first, last) and inserts each element into the set.

Parameters

  • first: The beginning of the range to insert.
  • last: The end of the range to insert.
Overload 3
constexpr iterator insert(const_iterator hint, value_type&& value) noexcept;

Summary

Inserts a moved value with a hint.

Behavior

Inserts the rvalue reference value into the set using the provided hint.

Parameters

  • hint: An iterator used as a hint for insertion.
  • value: The value to move and insert.

Returns

  • Return value 1: An iterator to the inserted element or the existing element.
Overload 4
constexpr void insert(std::initializer_list<value_type> ilist) noexcept;

Summary

Inserts elements from an initializer list.

Behavior

Iterates through the initializer list and inserts each value into the set.

Parameters

  • ilist: The initializer list containing values to insert.
Overload 5
constexpr std::pair<iterator, bool> insert(value_type&& value) noexcept;

Summary

Inserts a moved value.

Behavior

Inserts the rvalue reference value into the set.

Parameters

  • value: The value to move and insert.

Returns

  • Return value 1: A pair containing an iterator to the element and a boolean indicating if insertion took place.
Overload 6
constexpr std::pair<iterator, bool> insert(const value_type& value) noexcept;

Summary

Inserts a value into the set.

Behavior

Checks if the value can be indexed; if so, it sets the corresponding element to true and increments the size if it was not already present.

Parameters

  • value: The value to insert.

Returns

  • Return value 1: A pair containing an iterator to the element and a boolean that is true if the element was newly inserted.

Member Function: key_comp

Canonical path: magic_enum::containers::set::key_comp

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr key_compare key_comp() const;

Summary

Returns the function object that compares keys.

Behavior

Returns a default-constructed key_compare object.

Returns

  • Return value 1: A key comparison object.

Member Function: lower_bound

Canonical path: magic_enum::containers::set::lower_bound

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator lower_bound(const key_type& key) const noexcept;

Summary

Returns an iterator to the first element not less than the given key.

Behavior

Returns an iterator to the first element not less than the given key; if the key is not present, it returns the next available iterator or end().

Parameters

  • key: The key to compare elements against.

Returns

  • Return value 1: A constant iterator to the first element not less than the key.
Overload 2
[[nodiscard]] constexpr std::enable_if_t<detail::is_transparent_v<KC>, const_iterator> lower_bound(const K& x) const noexcept;

Summary

Returns a constant iterator to the first element not less than the given key.

Behavior

Finds the first element in the set that is not less than the specified key x using a transparent comparison.

Parameters

  • x: The key value to compare against the elements in the set.

Returns

  • Return value 1: A constant iterator to the first element that is not less than x, or end() if no such element is found.

Member Function: max_size

Canonical path: magic_enum::containers::set::max_size

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr size_type max_size() const noexcept;

Summary

Returns the maximum possible number of elements in the set.

Behavior

Retrieves the maximum number of elements the container is able to hold by calling max_size on the underlying member a.

Returns

  • Return value 1: The maximum number of elements the container can hold.

Member Function: operator!=

Canonical path: magic_enum::containers::set::operator!=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr friend bool operator!=(const set& lhs, const set& rhs) noexcept;

Summary

Checks if two sets are not equal.

Behavior

Compares the underlying member a of two set instances for inequality.

Parameters

  • lhs: The first set instance to compare.
  • rhs: The second set instance to compare.

Returns

  • Return value 1: True if the underlying members of the two sets are not equal, false otherwise.

Member Function: operator<

Canonical path: magic_enum::containers::set::operator<

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr friend bool operator<(const set& lhs, const set& rhs) noexcept;

Summary

Performs a lexicographical-style comparison to determine if one set is less than another.

Behavior

Compares two sets by first checking their size member s, and then iterating through all possible enum values to compare their presence in each set.

Parameters

  • lhs: The left-hand side set to compare.
  • rhs: The right-hand side set to compare.

Returns

  • Return value 1: True if the first set is strictly less than the second set based on size or element presence, false otherwise.

Member Function: operator<=

Canonical path: magic_enum::containers::set::operator<=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr friend bool operator<=(const set& lhs, const set& rhs) noexcept;

Summary

Compares two sets for less-than-or-equal-to relationship.

Behavior

Determines if the first set is less than or equal to the second set by checking if the second set is not less than the first.

Parameters

  • lhs: The left-hand side set for comparison.
  • rhs: The right-hand side set for comparison.

Returns

  • Return value 1: True if the first set is less than or equal to the second, false otherwise.

Member Function: operator=

Canonical path: magic_enum::containers::set::operator=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
constexpr set& operator=(set&&) noexcept = default;

Summary

Move assignment operator.

Behavior

Performs a default move assignment of the set.

Parameters

  • Parameter 1: The set instance to move from.

Returns

  • Return value 1: A reference to the assigned set.
Overload 2
constexpr set& operator=(const set&) noexcept = default;

Summary

Copy assignment operator.

Behavior

Performs a default copy assignment of the set.

Parameters

  • Parameter 1: The set instance to copy from.

Returns

  • Return value 1: A reference to the assigned set.
Overload 3
constexpr set& operator=(std::initializer_list<E> ilist);

Summary

Assigns the contents of an initializer list to the set.

Behavior

Iterates through the provided initializer list and inserts each element into the set.

Parameters

  • ilist: An initializer list containing elements of type E to be assigned to the set.

Returns

  • Return value 1: A reference to the modified set.

Member Function: operator==

Canonical path: magic_enum::containers::set::operator==

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr friend bool operator==(const set& lhs, const set& rhs) noexcept;

Summary

Checks if two sets are equal.

Behavior

Compares the underlying member a of two set instances for equality.

Parameters

  • lhs: The first set instance to compare.
  • rhs: The second set instance to compare.

Returns

  • Return value 1: True if the underlying members of the two sets are equal, false otherwise.

Member Function: operator>

Canonical path: magic_enum::containers::set::operator>

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr friend bool operator>(const set& lhs, const set& rhs) noexcept;

Summary

Compares two sets for greater-than relationship.

Behavior

Determines if the first set is greater than the second set by checking if the second set is less than the first.

Parameters

  • lhs: The left-hand side set for comparison.
  • rhs: The right-hand side set for comparison.

Returns

  • Return value 1: True if the first set is greater than the second, false otherwise.

Member Function: operator>=

Canonical path: magic_enum::containers::set::operator>=

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr friend bool operator>=(const set& lhs, const set& rhs) noexcept;

Summary

Compares two sets for greater-than-or-equal-to relationship.

Behavior

Determines if the first set is greater than or equal to the second set by checking if the first set is not less than the second.

Parameters

  • lhs: The left-hand side set for comparison.
  • rhs: The right-hand side set for comparison.

Returns

  • Return value 1: True if the first set is greater than or equal to the second, false otherwise.

Member Function: rbegin

Canonical path: magic_enum::containers::set::rbegin

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_reverse_iterator rbegin() const noexcept;

Summary

Returns a constant reverse iterator to the first element of the reversed set.

Behavior

Constructs a reverse iterator starting from the end of the set.

Returns

  • Return value 1: A constant reverse iterator to the beginning of the reversed set.

Member Function: rend

Canonical path: magic_enum::containers::set::rend

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

constexpr const_reverse_iterator rend() const noexcept;

Summary

Returns a constant reverse iterator to the element following the last element of the reversed set.

Behavior

Constructs a reverse iterator representing the end of the reversed set, starting from the beginning of the set.

Returns

  • Return value 1: A constant reverse iterator to the element following the last element of the reversed set.

Member Function: size

Canonical path: magic_enum::containers::set::size

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr size_type size() const noexcept;

Summary

Returns the number of elements in the set.

Behavior

Returns the current number of elements stored in the set by accessing the member s.

Returns

  • Return value 1: The number of elements in the set.

Member Function: swap

Canonical path: magic_enum::containers::set::swap

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

void swap(set& other) noexcept;

Summary

Swaps the contents of the set with another set.

Behavior

The method swaps the contents of the current set with another set by creating a copy of the current set, assigning the other set to the current one, and then assigning the copy to the other set.

Parameters

  • other: The set to swap with the current set.

Member Function: upper_bound

Canonical path: magic_enum::containers::set::upper_bound

Declared in: include/magic_enum/magic_enum_containers.hpp

Signatures

Overload 1
[[nodiscard]] constexpr const_iterator upper_bound(const key_type& key) const noexcept;

Summary

Returns a constant iterator to the first element greater than the specified key.

Behavior

If the provided key exists, the method returns an iterator to the next element; otherwise, it returns the end iterator.

Parameters

  • key: The key to search for in the set.

Returns

  • Return value 1: A constant iterator to the element following the specified key, or the end iterator if the key is not found.
Overload 2
[[nodiscard]] constexpr std::enable_if_t<detail::is_transparent_v<KC>, const_iterator> upper_bound(const K& x) const noexcept;

Summary

Returns a constant iterator to the first element greater than the specified value using a transparent comparator.

Behavior

The method uses a transparent comparison to find the equal range of the provided value and returns the upper bound of the last element in that range, or the end iterator if no match is found.

Parameters

  • x: The value to compare against the keys in the set.

Returns

  • Return value 1: A constant iterator to the first element greater than the specified value.

Member Function: value_comp

Canonical path: magic_enum::containers::set::value_comp

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

[[nodiscard]] constexpr value_compare value_comp() const;

Summary

Returns the function object that compares values.

Behavior

The method returns a default-constructed value_compare object.

Returns

  • Return value 1: A value_compare object used for comparing elements.

Struct: array

Canonical path: magic_enum::containers::array

Declared in: include/magic_enum/magic_enum_containers.hpp

Signature

struct array {};

Summary

A template struct representing a fixed-size array indexed by an enum.