| 2335 | }; |
| 2336 | |
| 2337 | class set : public anyset { |
| 2338 | public: |
| 2339 | PYBIND11_OBJECT_CVT(set, anyset, PySet_Check, PySet_New) |
| 2340 | set() : anyset(PySet_New(nullptr), stolen_t{}) { |
| 2341 | if (!m_ptr) { |
| 2342 | pybind11_fail("Could not allocate set object!"); |
| 2343 | } |
| 2344 | } |
| 2345 | template <typename T> |
| 2346 | bool add(T &&val) /* py-non-const */ { |
| 2347 | return PySet_Add(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr()) == 0; |
| 2348 | } |
| 2349 | void clear() /* py-non-const */ { PySet_Clear(m_ptr); } |
| 2350 | }; |
| 2351 | |
| 2352 | class frozenset : public anyset { |
| 2353 | public: |
no outgoing calls