mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-03 02:17:12 +00:00
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:
parent
d5b591d7f8
commit
4a4087fdd5
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user