I can not understand why this project uses the is_default_manageable construction. It seems that in it the conditional expression in std::is_same identically executed as true .
Code snippets from this project:
template<class T> void default_delete(T *p) SPIMPL_NOEXCEPT { delete p; } template<class T> struct default_deleter { using type = void (*)(T*); }; template<class T> using default_deleter_t = typename default_deleter<T>::type; template<class T, class D> struct is_default_manageable: public std::integral_constant <bool, std::is_same<D, default_deleter_t<T>>::value> {}; The class itself, I bring to the k, the accepting deleter and the second without him, use the default
template<class T, class Deleter = details::default_deleter_t<T>> class impl_ptr { using pointer = T*; using element_type = T; using copier_type = typename std::decay<Copier>::type; using deleter_type = typename std::decay<Deleter>::type; using unique_ptr_type = std::unique_ptr<T, deleter_type>; using is_default_manageable = details::is_default_manageable<T, deleter_type>; template<class D> impl_ptr(pointer p, D&& d, typename std::enable_if< std::is_convertible<D, deleter_type>::value, dummy_t_ >::type = dummy_t_()) : ptr_(std::move(p), std::forward<D>(d)) {} template<class U> impl_ptr(U* u, typename std::enable_if<std::is_convertible<U*,pointer>::value && is_default_manageable::value, dummy_t_ >::type = dummy_t_()) : impl_ptr(u, &details::default_delete<T>, &details::default_copy<T>) {} }; Something removed, copier for example, so as not to copier question with similar code.
is_sameidenticallytrue? I do not see any identity here. Secondly, in the second piece of code some kind of nonsense is written. Why are the parameters foris_default_manageablenot specified? - AnTdeleter_typealways identical todefault_deleter? - AnT