mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-16 21:57:55 +00:00
Manually picked diffs for pybind11.h (from remove_cross_extension_shared_state)
This commit is contained in:
parent
a4c5ab4b24
commit
cae3cf99b6
@ -13,6 +13,7 @@
|
|||||||
#include "detail/class.h"
|
#include "detail/class.h"
|
||||||
#include "detail/dynamic_raw_ptr_cast_if_possible.h"
|
#include "detail/dynamic_raw_ptr_cast_if_possible.h"
|
||||||
#include "detail/init.h"
|
#include "detail/init.h"
|
||||||
|
#include "detail/native_enum_data.h"
|
||||||
#include "detail/using_smart_holder.h"
|
#include "detail/using_smart_holder.h"
|
||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
#include "gil.h"
|
#include "gil.h"
|
||||||
@ -1352,6 +1353,11 @@ public:
|
|||||||
// For Python 2, reinterpret_borrow was correct.
|
// For Python 2, reinterpret_borrow was correct.
|
||||||
return reinterpret_borrow<module_>(m);
|
return reinterpret_borrow<module_>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module_ &operator+=(const detail::native_enum_data &data) {
|
||||||
|
detail::native_enum_add_to_parent(*this, data);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||||
@ -2161,6 +2167,11 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class_ &operator+=(const detail::native_enum_data &data) {
|
||||||
|
detail::native_enum_add_to_parent(*this, data);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Initialize holder object, variant 1: object derives from enable_shared_from_this
|
/// Initialize holder object, variant 1: object derives from enable_shared_from_this
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -2619,6 +2630,14 @@ public:
|
|||||||
template <typename... Extra>
|
template <typename... Extra>
|
||||||
enum_(const handle &scope, const char *name, const Extra &...extra)
|
enum_(const handle &scope, const char *name, const Extra &...extra)
|
||||||
: class_<Type>(scope, name, extra...), m_base(*this, scope) {
|
: class_<Type>(scope, name, extra...), m_base(*this, scope) {
|
||||||
|
{
|
||||||
|
if (detail::global_internals_native_enum_type_map_contains(
|
||||||
|
std::type_index(typeid(Type)))) {
|
||||||
|
pybind11_fail("pybind11::enum_ \"" + std::string(name)
|
||||||
|
+ "\" is already registered as a pybind11::native_enum!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
constexpr bool is_arithmetic = detail::any_of<std::is_same<arithmetic, Extra>...>::value;
|
constexpr bool is_arithmetic = detail::any_of<std::is_same<arithmetic, Extra>...>::value;
|
||||||
constexpr bool is_convertible = std::is_convertible<Type, Underlying>::value;
|
constexpr bool is_convertible = std::is_convertible<Type, Underlying>::value;
|
||||||
m_base.init(is_arithmetic, is_convertible);
|
m_base.init(is_arithmetic, is_convertible);
|
||||||
|
Loading…
Reference in New Issue
Block a user