
El 03/09/2014 22:33, Peter Dimov escribió:
Ion Gaztañaga wrote:
One problem I've found for constructors taking the pointer is that the pointer can be an incomplete type whereas has_trivial_destructor requires a complete type.
Are we in the default_delete case here, or in the arbitrary deleter case?
I was trying in the default_delete case, sfinaeing out this constructor: template<class U, E> unique_ptr(unique_ptr<U, E> &&u, enable_if<... E ....>... ) As E must be convertible to D, and to check this, it was checking if T was a base class of U and had no virtual destructor, it seems that the intrinsic complained about non-complete types. Maybe I was not properly filtering it first with is_convertible. I've changed that approach to static_assert inside the function instead of sfinaeing the constructor. This seems to work. In any case, is expected is_convertible<T*, U*>::value to return false with pointers to incomplete types? Best, Ion