| 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; |