mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 17:37:15 +00:00
copyable_holder_caster<type, std::shared_ptr<type>>
: split load_value_shared_ptr()
, load_value_smart_holder()
(the latter just throws right now)
This commit is contained in:
parent
556f28a1a4
commit
17c0354050
@ -867,13 +867,9 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class type_caster_generic;
|
friend class type_caster_generic;
|
||||||
void check_holder_compat() {
|
void check_holder_compat() {}
|
||||||
if (typeinfo->default_holder) {
|
|
||||||
throw cast_error("Unable to load a custom holder type from a default-holder instance");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool load_value(value_and_holder &&v_h) {
|
bool load_value_shared_ptr(value_and_holder &&v_h) {
|
||||||
if (v_h.holder_constructed()) {
|
if (v_h.holder_constructed()) {
|
||||||
value = v_h.value_ptr();
|
value = v_h.value_ptr();
|
||||||
holder = v_h.template holder<std::shared_ptr<type>>();
|
holder = v_h.template holder<std::shared_ptr<type>>();
|
||||||
@ -889,6 +885,17 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool load_value_smart_holder(value_and_holder && /*v_h*/) {
|
||||||
|
throw std::runtime_error("BAKEIN_WIP load_value_smart_holder");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool load_value(value_and_holder &&v_h) {
|
||||||
|
if (typeinfo->default_holder) {
|
||||||
|
return load_value_smart_holder(std::move(v_h));
|
||||||
|
}
|
||||||
|
return load_value_shared_ptr(std::move(v_h));
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T = std::shared_ptr<type>,
|
template <typename T = std::shared_ptr<type>,
|
||||||
detail::enable_if_t<!std::is_constructible<T, const T &, type *>::value, int> = 0>
|
detail::enable_if_t<!std::is_constructible<T, const T &, type *>::value, int> = 0>
|
||||||
bool try_implicit_casts(handle, bool) {
|
bool try_implicit_casts(handle, bool) {
|
||||||
|
Loading…
Reference in New Issue
Block a user