diff --git a/include/pybind11/common.h b/include/pybind11/common.h index 1db822306..ef94f3854 100644 --- a/include/pybind11/common.h +++ b/include/pybind11/common.h @@ -378,9 +378,11 @@ inline internals &get_internals(); #ifdef PYBIND11_CPP14 using std::enable_if_t; using std::conditional_t; +using std::remove_cv_t; #else template using enable_if_t = typename std::enable_if::type; template using conditional_t = typename std::conditional::type; +template using remove_cv_t = typename std::remove_cv::type; #endif /// Index sequences @@ -499,9 +501,9 @@ struct is_template_base_of_impl { /// `is_template_base_of` is true if `struct T : Base {}` where U can be anything template class Base, typename T> #if !defined(_MSC_VER) -using is_template_base_of = decltype(is_template_base_of_impl::check((T*)nullptr)); +using is_template_base_of = decltype(is_template_base_of_impl::check((remove_cv_t*)nullptr)); #else // MSVC2015 has trouble with decltype in template aliases -struct is_template_base_of : decltype(is_template_base_of_impl::check((T*)nullptr)) { }; +struct is_template_base_of : decltype(is_template_base_of_impl::check((remove_cv_t*)nullptr)) { }; #endif /// Check if T is std::shared_ptr where U can be anything