Remove PYBIND11_SMART_HOLDER_ENABLED in ubench/holder_comparison.cpp

This commit is contained in:
Ralf W. Grosse-Kunstleve 2025-02-18 20:13:01 -08:00
parent febbd55a15
commit 17d46d5501
No known key found for this signature in database

View File

@ -22,8 +22,6 @@ void wrap_number_bucket(py::module m, const char *class_name) {
.def("add", &WrappedType::add, py::arg("other")); .def("add", &WrappedType::add, py::arg("other"));
} }
#ifdef PYBIND11_SMART_HOLDER_ENABLED
template <typename T> template <typename T>
class padded_unique_ptr { class padded_unique_ptr {
std::unique_ptr<T> ptr; std::unique_ptr<T> ptr;
@ -37,21 +35,15 @@ public:
static_assert(sizeof(padded_unique_ptr<nb_pu>) == sizeof(py::smart_holder), static_assert(sizeof(padded_unique_ptr<nb_pu>) == sizeof(py::smart_holder),
"Unexpected sizeof mismatch."); "Unexpected sizeof mismatch.");
#endif
} // namespace hc } // namespace hc
#ifdef PYBIND11_SMART_HOLDER_ENABLED
PYBIND11_DECLARE_HOLDER_TYPE(T, hc::padded_unique_ptr<T>); PYBIND11_DECLARE_HOLDER_TYPE(T, hc::padded_unique_ptr<T>);
#endif
PYBIND11_MODULE(pybind11_ubench_holder_comparison, m) { PYBIND11_MODULE(pybind11_ubench_holder_comparison, m) {
using namespace hc; using namespace hc;
wrap_number_bucket<nb_up, std::unique_ptr<nb_up>>(m, "number_bucket_up"); wrap_number_bucket<nb_up, std::unique_ptr<nb_up>>(m, "number_bucket_up");
wrap_number_bucket<nb_sp, std::shared_ptr<nb_sp>>(m, "number_bucket_sp"); wrap_number_bucket<nb_sp, std::shared_ptr<nb_sp>>(m, "number_bucket_sp");
#ifdef PYBIND11_SMART_HOLDER_ENABLED
m.def("sizeof_smart_holder", []() { return sizeof(py::smart_holder); }); m.def("sizeof_smart_holder", []() { return sizeof(py::smart_holder); });
wrap_number_bucket<nb_pu, padded_unique_ptr<nb_pu>>(m, "number_bucket_pu"); wrap_number_bucket<nb_pu, padded_unique_ptr<nb_pu>>(m, "number_bucket_pu");
wrap_number_bucket<nb_sh, py::smart_holder>(m, "number_bucket_sh"); wrap_number_bucket<nb_sh, py::smart_holder>(m, "number_bucket_sh");
#endif
} }