mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-26 07:02:11 +00:00
test_class.cpp: simpler approach, leveraging new PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
This commit is contained in:
parent
d0003f5660
commit
89d0ddd6ff
@ -1800,6 +1800,7 @@ struct property_cpp_function<
|
|||||||
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
|
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
|
||||||
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
|
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
|
||||||
// BAKEIN_WIP: Add comment to explain: This is meant for stress-testing only.
|
// BAKEIN_WIP: Add comment to explain: This is meant for stress-testing only.
|
||||||
|
# define PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
|
||||||
template <typename>
|
template <typename>
|
||||||
using default_holder_type = smart_holder;
|
using default_holder_type = smart_holder;
|
||||||
#else
|
#else
|
||||||
|
@ -607,17 +607,10 @@ CHECK_NOALIAS(8);
|
|||||||
static_assert(std::is_same<typename DoesntBreak##N::holder_type, \
|
static_assert(std::is_same<typename DoesntBreak##N::holder_type, \
|
||||||
std::TYPE##_ptr<BreaksBase<(N)>>>::value, \
|
std::TYPE##_ptr<BreaksBase<(N)>>>::value, \
|
||||||
"DoesntBreak" #N " has wrong holder_type!")
|
"DoesntBreak" #N " has wrong holder_type!")
|
||||||
#define CHECK_SMART_HOLDER(N) \
|
|
||||||
static_assert(std::is_same<typename DoesntBreak##N::holder_type, py::smart_holder>::value, \
|
|
||||||
"DoesntBreak" #N " has wrong holder_type!")
|
|
||||||
CHECK_HOLDER(1, unique);
|
CHECK_HOLDER(1, unique);
|
||||||
CHECK_HOLDER(2, unique);
|
CHECK_HOLDER(2, unique);
|
||||||
CHECK_HOLDER(3, unique);
|
CHECK_HOLDER(3, unique);
|
||||||
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
|
#ifndef PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
|
||||||
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
|
|
||||||
CHECK_SMART_HOLDER(4);
|
|
||||||
CHECK_SMART_HOLDER(5);
|
|
||||||
#else
|
|
||||||
CHECK_HOLDER(4, unique);
|
CHECK_HOLDER(4, unique);
|
||||||
CHECK_HOLDER(5, unique);
|
CHECK_HOLDER(5, unique);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user