Systematically replacing `detail::enable_if_t<...smart_holder...>` with `typename std::enable_if<...smart_holder...>::type`. Attempt to work around MSVC 2015 issues, to be tested via GitHub CI. The idea for this change originates from this comment: https://github.com/pybind/pybind11/issues/1616#issuecomment-444536813

This commit is contained in:
Ralf W. Grosse-Kunstleve 2021-02-12 13:46:18 -08:00
parent 7aa604d9d4
commit 5d4b6890a3
3 changed files with 8 additions and 8 deletions

View File

@ -2459,7 +2459,7 @@ struct is_smart_holder_type_caster : std::false_type {};
template <typename T>
struct is_smart_holder_type_caster<
T,
enable_if_t<type_caster<T>::is_smart_holder_type_caster::value, void>> : std::true_type {};
typename std::enable_if<type_caster<T>::is_smart_holder_type_caster::value, void>::type> : std::true_type {};
template <typename T>
inline bool check_is_smart_holder_type_caster() {

View File

@ -132,7 +132,7 @@ void construct(value_and_holder &v_h, Alias<Class> *alias_ptr, bool) {
// holder. This also handles types like std::shared_ptr<T> and std::unique_ptr<T> where T is a
// derived type (through those holder's implicit conversion from derived class holder constructors).
template <typename Class,
detail::enable_if_t<!detail::is_smart_holder_type_caster<Cpp<Class>>::value, int> = 0>
typename std::enable_if<!detail::is_smart_holder_type_caster<Cpp<Class>>::value, int>::type = 0>
void construct(value_and_holder &v_h, Holder<Class> holder, bool need_alias) {
auto *ptr = holder_helper<Holder<Class>>::get(holder);
no_nullptr(ptr);
@ -172,7 +172,7 @@ void construct(value_and_holder &v_h, Alias<Class> &&result, bool) {
//DETAIL/SMART_HOLDER_INIT_H/BEGIN/////////////////////////////////////////////////////////////////
template <typename Class, typename D = std::default_delete<Cpp<Class>>,
detail::enable_if_t<detail::is_smart_holder_type_caster<Cpp<Class>>::value, int> = 0>
typename std::enable_if<detail::is_smart_holder_type_caster<Cpp<Class>>::value, int>::type = 0>
void construct(value_and_holder &v_h, std::unique_ptr<Cpp<Class>, D> &&unq_ptr, bool need_alias) {
auto *ptr = unq_ptr.get();
no_nullptr(ptr);
@ -188,7 +188,7 @@ void construct(value_and_holder &v_h, std::unique_ptr<Cpp<Class>, D> &&unq_ptr,
}
template <typename Class,
detail::enable_if_t<detail::is_smart_holder_type_caster<Cpp<Class>>::value, int> = 0>
typename std::enable_if<detail::is_smart_holder_type_caster<Cpp<Class>>::value, int>::type = 0>
void construct(value_and_holder &v_h, std::shared_ptr<Cpp<Class>> &&shd_ptr, bool need_alias) {
auto *ptr = shd_ptr.get();
no_nullptr(ptr);

View File

@ -1544,14 +1544,14 @@ public:
private:
template <
typename T = type,
detail::enable_if_t<!detail::is_smart_holder_type_caster<T>::value, int> = 0>
typename std::enable_if<!detail::is_smart_holder_type_caster<T>::value, int>::type = 0>
void generic_type_initialize(const detail::type_record &record) {
generic_type::initialize(record, &detail::type_caster_generic::local_load);
}
template <
typename T = type,
detail::enable_if_t<detail::is_smart_holder_type_caster<T>::value, int> = 0>
typename std::enable_if<detail::is_smart_holder_type_caster<T>::value, int>::type = 0>
void generic_type_initialize(const detail::type_record &record) {
generic_type::initialize(record, detail::type_caster<T>::get_local_load_function_ptr());
}
@ -1602,7 +1602,7 @@ private:
/// `.owned`, a new holder will be constructed to manage the value pointer.
template <
typename T = type,
detail::enable_if_t<!detail::is_smart_holder_type_caster<T>::value, int> = 0>
typename std::enable_if<!detail::is_smart_holder_type_caster<T>::value, int>::type = 0>
static void init_instance(detail::instance *inst, const void *holder_ptr) {
auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type)));
if (!v_h.instance_registered()) {
@ -1614,7 +1614,7 @@ private:
template <
typename T = type,
detail::enable_if_t<detail::is_smart_holder_type_caster<T>::value, int> = 0>
typename std::enable_if<detail::is_smart_holder_type_caster<T>::value, int>::type = 0>
static void init_instance(detail::instance *inst, const void *holder_ptr) {
detail::type_caster<T>::template init_instance_for_type<type>(inst, holder_ptr);
}