12#include <initializer_list>
13#include <unordered_set>
28 template <
typename Key>
class set :
public std::unordered_set<Key> {
30 using Base = std::unordered_set<Key>;
43 template <
typename FwdIter>
set(
const FwdIter& start,
const FwdIter& stop)
44 : Base(start, stop) {}
51 set(std::initializer_list<Key> init) : Base{init} {}
59 auto contains(
const Key& key)
const ->
bool {
return this->find(key) != this->end(); }
66 auto copy() const ->
set {
return *
this; }
92 ~
set() noexcept = default;
111 template <typename Key> inline auto operator<(const Key& key, const
set<Key>& m) ->
bool {
122 template <
typename Key>
inline auto len(
const set<Key>& m)
noexcept ->
size_t {
Python-like set implementation.
Definition set.hpp:28
auto operator=(set &&) noexcept -> set &=default
Move assignment operator.
set(std::initializer_list< Key > init)
Construct a new set object from an initializer list.
Definition set.hpp:51
auto operator=(const set &) -> set &=delete
Copy assignment operator (deleted)
auto contains(const Key &key) const -> bool
Check if the set contains a specific element.
Definition set.hpp:59
set()
Construct a new set object.
Definition set.hpp:37
auto copy() const -> set
Create a copy of the set.
Definition set.hpp:66
set(const FwdIter &start, const FwdIter &stop)
Construct a new set object.
Definition set.hpp:43
Python-like utilities and data structures for C++.
Definition dict.hpp:18
auto len(const dict< Key, T > &m) noexcept -> size_t
Get the number of key-value pairs in a dictionary.
Definition dict.hpp:284