test_class.cpp: simpler approach, leveraging new PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT

This commit is contained in:
Ralf W. Grosse-Kunstleve 2024-07-20 19:40:38 -07:00
parent d0003f5660
commit 89d0ddd6ff
2 changed files with 2 additions and 8 deletions

View File

@ -1800,6 +1800,7 @@ struct property_cpp_function<
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
// BAKEIN_WIP: Add comment to explain: This is meant for stress-testing only.
# define PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
template <typename>
using default_holder_type = smart_holder;
#else

View File

@ -607,17 +607,10 @@ CHECK_NOALIAS(8);
static_assert(std::is_same<typename DoesntBreak##N::holder_type, \
std::TYPE##_ptr<BreaksBase<(N)>>>::value, \
"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(2, unique);
CHECK_HOLDER(3, unique);
#if defined(PYBIND11_USE_SMART_HOLDER_AS_DEFAULT) \
&& defined(PYBIND11_HAVE_INTERNALS_WITH_SMART_HOLDER_SUPPORT)
CHECK_SMART_HOLDER(4);
CHECK_SMART_HOLDER(5);
#else
#ifndef PYBIND11_ACTUALLY_USING_SMART_HOLDER_AS_DEFAULT
CHECK_HOLDER(4, unique);
CHECK_HOLDER(5, unique);
#endif