mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
minor cleanups in pytypes.h
This commit is contained in:
parent
ca9f3b2d8e
commit
60abf299c6
@ -323,10 +323,10 @@ public:
|
|||||||
PYBIND11_OBJECT_DEFAULT(iterable, object, detail::PyIterable_Check)
|
PYBIND11_OBJECT_DEFAULT(iterable, object, detail::PyIterable_Check)
|
||||||
};
|
};
|
||||||
|
|
||||||
inline detail::accessor handle::operator[](handle key) const { return detail::accessor(ptr(), key.ptr(), false); }
|
inline detail::accessor handle::operator[](handle key) const { return detail::accessor(*this, key, false); }
|
||||||
inline detail::accessor handle::operator[](const char *key) const { return detail::accessor(ptr(), key, false); }
|
inline detail::accessor handle::operator[](const char *key) const { return detail::accessor(*this, key, false); }
|
||||||
inline detail::accessor handle::attr(handle key) const { return detail::accessor(ptr(), key.ptr(), true); }
|
inline detail::accessor handle::attr(handle key) const { return detail::accessor(*this, key, true); }
|
||||||
inline detail::accessor handle::attr(const char *key) const { return detail::accessor(ptr(), key, true); }
|
inline detail::accessor handle::attr(const char *key) const { return detail::accessor(*this, key, true); }
|
||||||
inline iterator handle::begin() const { return iterator(PyObject_GetIter(ptr()), false); }
|
inline iterator handle::begin() const { return iterator(PyObject_GetIter(ptr()), false); }
|
||||||
inline iterator handle::end() const { return iterator(nullptr, false); }
|
inline iterator handle::end() const { return iterator(nullptr, false); }
|
||||||
inline detail::args_proxy handle::operator*() const { return detail::args_proxy(*this); }
|
inline detail::args_proxy handle::operator*() const { return detail::args_proxy(*this); }
|
||||||
@ -501,7 +501,7 @@ public:
|
|||||||
if (!m_ptr) pybind11_fail("Could not allocate dict object!");
|
if (!m_ptr) pybind11_fail("Could not allocate dict object!");
|
||||||
}
|
}
|
||||||
size_t size() const { return (size_t) PyDict_Size(m_ptr); }
|
size_t size() const { return (size_t) PyDict_Size(m_ptr); }
|
||||||
detail::dict_iterator begin() const { return (++detail::dict_iterator(ptr(), 0)); }
|
detail::dict_iterator begin() const { return (++detail::dict_iterator(*this, 0)); }
|
||||||
detail::dict_iterator end() const { return detail::dict_iterator(); }
|
detail::dict_iterator end() const { return detail::dict_iterator(); }
|
||||||
void clear() const { PyDict_Clear(ptr()); }
|
void clear() const { PyDict_Clear(ptr()); }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user