mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-29 08:32:02 +00:00
Use new PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP
to exclude smart_holder::as_unique_ptr
method from production code.
This commit is contained in:
parent
4fb7d12813
commit
4d9d722215
@ -335,6 +335,7 @@ struct smart_holder {
|
||||
return hld;
|
||||
}
|
||||
|
||||
#ifdef PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP
|
||||
template <typename T, typename D = std::default_delete<T>>
|
||||
std::unique_ptr<T, D> as_unique_ptr() {
|
||||
static const char *context = "as_unique_ptr";
|
||||
@ -344,6 +345,7 @@ struct smart_holder {
|
||||
release_ownership();
|
||||
return std::unique_ptr<T, D>(raw_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T>
|
||||
static smart_holder from_shared_ptr(std::shared_ptr<T> shd_ptr) {
|
||||
|
@ -1,3 +1,5 @@
|
||||
#define PYBIND11_TESTS_PURE_CPP_SMART_HOLDER_POC_TEST_CPP
|
||||
|
||||
#include "pybind11/detail/smart_holder_poc.h"
|
||||
|
||||
#include <functional>
|
||||
|
Loading…
Reference in New Issue
Block a user