mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-30 00:47:12 +00:00
minor: have enum::export_values() return a reference to *this as usual
This commit is contained in:
parent
f1b44a051a
commit
e916d846bf
@ -1215,13 +1215,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Export enumeration entries into the parent scope
|
/// Export enumeration entries into the parent scope
|
||||||
void export_values() {
|
enum_ &export_values() {
|
||||||
PyObject *dict = ((PyTypeObject *) this->m_ptr)->tp_dict;
|
PyObject *dict = ((PyTypeObject *) this->m_ptr)->tp_dict;
|
||||||
PyObject *key, *value;
|
PyObject *key, *value;
|
||||||
ssize_t pos = 0;
|
ssize_t pos = 0;
|
||||||
while (PyDict_Next(dict, &pos, &key, &value))
|
while (PyDict_Next(dict, &pos, &key, &value))
|
||||||
if (PyObject_IsInstance(value, this->m_ptr))
|
if (PyObject_IsInstance(value, this->m_ptr))
|
||||||
m_parent.attr(key) = value;
|
m_parent.attr(key) = value;
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add an enumeration entry
|
/// Add an enumeration entry
|
||||||
|
Loading…
Reference in New Issue
Block a user