Moving define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) down in the file. NO functional changes. Preparation for follow-up work (to keep that diff smaller).

This commit is contained in:
Ralf W. Grosse-Kunstleve 2021-01-27 12:30:32 -08:00
parent d5b591d7f8
commit 4a4087fdd5

View File

@ -582,26 +582,6 @@ struct smart_holder_type_caster<std::unique_ptr<T const>> : smart_holder_type_ca
operator std::unique_ptr<T const>() { return this->loaded_as_unique_ptr(); } operator std::unique_ptr<T const>() { return this->loaded_as_unique_ptr(); }
}; };
#define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) \
namespace pybind11 { \
namespace detail { \
template <> \
class type_caster<T> : public smart_holder_type_caster<T> {}; \
template <> \
class type_caster<std::shared_ptr<T>> : public smart_holder_type_caster<std::shared_ptr<T>> { \
}; \
template <> \
class type_caster<std::shared_ptr<T const>> \
: public smart_holder_type_caster<std::shared_ptr<T const>> {}; \
template <> \
class type_caster<std::unique_ptr<T>> : public smart_holder_type_caster<std::unique_ptr<T>> { \
}; \
template <> \
class type_caster<std::unique_ptr<T const>> \
: public smart_holder_type_caster<std::unique_ptr<T const>> {}; \
} \
}
template <> template <>
struct is_smart_holder<pybindit::memory::smart_holder> struct is_smart_holder<pybindit::memory::smart_holder>
: is_smart_holder<pybindit::memory::smart_holder, true> { : is_smart_holder<pybindit::memory::smart_holder, true> {
@ -638,5 +618,25 @@ struct is_smart_holder<pybindit::memory::smart_holder>
} }
}; };
#define PYBIND11_SMART_HOLDER_TYPE_CASTERS(T) \
namespace pybind11 { \
namespace detail { \
template <> \
class type_caster<T> : public smart_holder_type_caster<T> {}; \
template <> \
class type_caster<std::shared_ptr<T>> : public smart_holder_type_caster<std::shared_ptr<T>> { \
}; \
template <> \
class type_caster<std::shared_ptr<T const>> \
: public smart_holder_type_caster<std::shared_ptr<T const>> {}; \
template <> \
class type_caster<std::unique_ptr<T>> : public smart_holder_type_caster<std::unique_ptr<T>> { \
}; \
template <> \
class type_caster<std::unique_ptr<T const>> \
: public smart_holder_type_caster<std::unique_ptr<T const>> {}; \
} \
}
} // namespace detail } // namespace detail
} // namespace pybind11 } // namespace pybind11