Over the years, we settled on a consistent pattern for SFINAE: default template arguments of the form enable_if_t<CONDITION, int> = 0. This works in a wide variety of situations, including when we have an overload set where SFINAE makes exactly one overload viable. There are a few remaining occurrences of SFINAE that don't follow this pattern.
In <memory>, these occurrences are _Enable_ctor_reset and _Enable_conversion:
|
template <class _Uty, class _Is_nullptr = is_same<_Uty, nullptr_t>>
|
|
using _Enable_ctor_reset = enable_if_t<is_same_v<_Uty, pointer> //
|
|
|| _Is_nullptr::value //
|
|
|| (is_same_v<pointer, element_type*> //
|
|
&& is_pointer_v<_Uty> //
|
|
&& is_convertible_v<remove_pointer_t<_Uty> (*)[], element_type (*)[]>)>;
|
|
template <class _Uty, class _Ex, class _More, class _UP_pointer = typename unique_ptr<_Uty, _Ex>::pointer,
|
|
class _UP_element_type = typename unique_ptr<_Uty, _Ex>::element_type>
|
|
using _Enable_conversion = enable_if_t<conjunction_v<is_array<_Uty>, is_same<pointer, element_type*>,
|
|
is_same<_UP_pointer, _UP_element_type*>, is_convertible<_UP_element_type (*)[], element_type (*)[]>, _More>>;
|
This change is currently blocked by a compiler bug. We need to provide a reduced test case to the compiler front-end team.
(Split from #187.)
Over the years, we settled on a consistent pattern for SFINAE: default template arguments of the form
enable_if_t<CONDITION, int> = 0. This works in a wide variety of situations, including when we have an overload set where SFINAE makes exactly one overload viable. There are a few remaining occurrences of SFINAE that don't follow this pattern.In
<memory>, these occurrences are_Enable_ctor_resetand_Enable_conversion:STL/stl/inc/memory
Lines 1933 to 1938 in 28ec9a3
STL/stl/inc/memory
Lines 1975 to 1978 in 28ec9a3
This change is currently blocked by a compiler bug. We need to provide a reduced test case to the compiler front-end team.
(Split from #187.)