template<typename Key>
py::set class

Python-like set implementation.

Template parameters
Key The element type stored in the set

A set class that extends std::unordered_set with Python-like convenience methods and functionality.

Constructors, destructors, conversion operators

set()
Construct a new set object.
template<typename FwdIter>
set(const FwdIter& start, const FwdIter& stop)
Construct a new set object.
set(std::initializer_list<Key> init)
Construct a new set object from an initializer list.
set(set<Key>&&) defaulted noexcept
Move Constructor (default)
set(const set<Key>&) defaulted
Copy Constructor (deleted)

Public functions

auto contains(const Key& key) const -> bool -> auto
Check if the set contains a specific element.
auto copy() const -> set -> auto
Create a copy of the set.
auto operator=(const set&) -> set & -> auto deleted
Copy assignment operator (deleted)
auto operator=(set&&) noexcept -> set & -> auto defaulted
Move assignment operator.

Function documentation

template<typename Key>
py::set<Key>::set(std::initializer_list<Key> init)

Construct a new set object from an initializer list.

Parameters
init in Initializer list of elements

template<typename Key>
py::set<Key>::set(const set<Key>&) defaulted

Copy Constructor (deleted)

Copy through explicitly the public copy() function!!!

template<typename Key>
auto py::set<Key>::contains(const Key& key) const -> bool

Check if the set contains a specific element.

Parameters
key in The element to check
Returns true if the set contains the element, false otherwise

template<typename Key>
auto py::set<Key>::copy() const -> set

Create a copy of the set.

Returns Self A copy of this set

template<typename Key>
auto py::set<Key>::operator=(const set&) -> set & deleted

Copy assignment operator (deleted)

Use copy() method instead for explicit copying.

template<typename Key>
auto py::set<Key>::operator=(set&&) noexcept -> set & defaulted

Move assignment operator.

Returns Self& Reference to this set