diff mbox

[v3] Make the default constructors of tuple and pair conditionally explicit.

Message ID 5637D079.1070906@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Nov. 2, 2015, 9:07 p.m. UTC
Hi,

On 11/02/2015 09:20 PM, Ville Voutilainen wrote:
> On 2 November 2015 at 21:20, Paolo Carlini <paolo.carlini@oracle.com> wrote:
>> Can we follow the terse style already used elsewhere (eg,
>> __is_direct_constructible_new_safe) thus directly inherit from __and_ and
>> avoid explicit integral_constant? Otherwise patch looks good to me.
>
> Sure. Tested again on Linux-PPC64, tests adjusted due to line changes,
> Changelog entry updated to have a correct date on it.
Great, thanks a lot. Thinking more about this detail, I wonder if we 
should therefore apply the below too? Anything I'm missing?

Paolo.

///////////////

Comments

Jonathan Wakely Nov. 3, 2015, 2:42 p.m. UTC | #1
On 3 November 2015 at 02:37, Paolo Carlini wrote:
> Hi,
>
> On 11/02/2015 09:20 PM, Ville Voutilainen wrote:
>>
>> On 2 November 2015 at 21:20, Paolo Carlini <paolo.carlini@oracle.com>
>> wrote:
>>>
>>> Can we follow the terse style already used elsewhere (eg,
>>> __is_direct_constructible_new_safe) thus directly inherit from __and_ and
>>> avoid explicit integral_constant? Otherwise patch looks good to me.
>>
>>
>> Sure. Tested again on Linux-PPC64, tests adjusted due to line changes,
>> Changelog entry updated to have a correct date on it.
>
> Great, thanks a lot. Thinking more about this detail, I wonder if we should
> therefore apply the below too? Anything I'm missing?

I have a weak preference for deriving from xxx::type rather than xxx,
so that the traits derive directly from either true_type or
false_type, not indirectly via some other type that derives from
true_type or false_type, but it probably isn't important.
Ville Voutilainen Nov. 3, 2015, 2:49 p.m. UTC | #2
On 3 November 2015 at 16:42, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 3 November 2015 at 02:37, Paolo Carlini wrote:
>> Hi,
>>
>> On 11/02/2015 09:20 PM, Ville Voutilainen wrote:
>>>
>>> On 2 November 2015 at 21:20, Paolo Carlini <paolo.carlini@oracle.com>
>>> wrote:
>>>>
>>>> Can we follow the terse style already used elsewhere (eg,
>>>> __is_direct_constructible_new_safe) thus directly inherit from __and_ and
>>>> avoid explicit integral_constant? Otherwise patch looks good to me.
>>>
>>>
>>> Sure. Tested again on Linux-PPC64, tests adjusted due to line changes,
>>> Changelog entry updated to have a correct date on it.
>>
>> Great, thanks a lot. Thinking more about this detail, I wonder if we should
>> therefore apply the below too? Anything I'm missing?
>
> I have a weak preference for deriving from xxx::type rather than xxx,
> so that the traits derive directly from either true_type or
> false_type, not indirectly via some other type that derives from
> true_type or false_type, but it probably isn't important.

I expect the inheritance hierarchies of these things to be linear, so
probably not
a huge matter. I did push the patch already. :)
diff mbox

Patch

Index: type_traits
===================================================================
--- type_traits	(revision 229652)
+++ type_traits	(working copy)
@@ -715,7 +715,7 @@ 
   /// is_unsigned
   template<typename _Tp>
     struct is_unsigned
-    : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>::type
+    : public __and_<is_arithmetic<_Tp>, __not_<is_signed<_Tp>>>
     { };
 
 
@@ -744,7 +744,7 @@ 
 
   template<typename _Tp>
     struct __is_array_unknown_bounds
-    : public __and_<is_array<_Tp>, __not_<extent<_Tp>>>::type
+    : public __and_<is_array<_Tp>, __not_<extent<_Tp>>>
     { };
     
   // In N3290 is_destructible does not say anything about function
@@ -862,7 +862,7 @@ 
   template<typename _Tp>
     struct __is_default_constructible_atom
     : public __and_<__not_<is_void<_Tp>>,
-                    __is_default_constructible_impl<_Tp>>::type
+                    __is_default_constructible_impl<_Tp>>
     { };
 
   template<typename _Tp, bool = is_array<_Tp>::value>
@@ -877,7 +877,7 @@ 
     struct __is_default_constructible_safe<_Tp, true>
     : public __and_<__is_array_known_bounds<_Tp>,
 		    __is_default_constructible_atom<typename
-                      remove_all_extents<_Tp>::type>>::type
+                      remove_all_extents<_Tp>::type>>
     { };
 
   template<typename _Tp>
@@ -957,7 +957,7 @@ 
   template<typename _Tp, typename _Arg>
     struct __is_direct_constructible_new_safe
     : public __and_<is_destructible<_Tp>,
-                    __is_direct_constructible_impl<_Tp, _Arg>>::type
+                    __is_direct_constructible_impl<_Tp, _Arg>>
     { };
 
   template<typename, typename>
@@ -1029,7 +1029,7 @@ 
     : public __and_<__is_static_castable<_Arg, _Tp>,
                     __not_<__or_<__is_base_to_derived_ref<_Arg, _Tp>,
                                  __is_lvalue_to_rvalue_ref<_Arg, _Tp>
-                   >>>::type
+                   >>>
     { };
 
   template<typename _Tp, typename _Arg>
@@ -1144,7 +1144,7 @@ 
     struct __is_nt_default_constructible_impl<_Tp, true>
     : public __and_<__is_array_known_bounds<_Tp>,
 		    __is_nt_default_constructible_atom<typename
-                      remove_all_extents<_Tp>::type>>::type
+                      remove_all_extents<_Tp>::type>>
     { };
 
   template<typename _Tp>
@@ -1156,7 +1156,7 @@ 
   template<typename _Tp>
     struct is_nothrow_default_constructible
     : public __and_<is_default_constructible<_Tp>,
-                    __is_nt_default_constructible_impl<_Tp>>::type
+                    __is_nt_default_constructible_impl<_Tp>>
     { };
 
   template<typename _Tp, typename... _Args>
@@ -1179,7 +1179,7 @@ 
   template<typename _Tp, typename... _Args>
     struct is_nothrow_constructible
     : public __and_<is_constructible<_Tp, _Args...>,
-		    __is_nt_constructible_impl<_Tp, _Args...>>::type
+		    __is_nt_constructible_impl<_Tp, _Args...>>
     { };
 
   template<typename _Tp, bool = __is_referenceable<_Tp>::value>
@@ -1285,7 +1285,7 @@ 
   template<typename _Tp, typename _Up>
     struct is_nothrow_assignable
     : public __and_<is_assignable<_Tp, _Up>,
-		    __is_nt_assignable_impl<_Tp, _Up>>::type
+		    __is_nt_assignable_impl<_Tp, _Up>>
     { };
 
   template<typename _Tp, bool = __is_referenceable<_Tp>::value>
@@ -1328,7 +1328,7 @@ 
   template<typename _Tp, typename... _Args>
     struct is_trivially_constructible
     : public __and_<is_constructible<_Tp, _Args...>, integral_constant<bool,
-			__is_trivially_constructible(_Tp, _Args...)>>::type
+			__is_trivially_constructible(_Tp, _Args...)>>
     { };
   
   /// is_trivially_default_constructible
@@ -1342,7 +1342,7 @@ 
     struct is_trivially_copy_constructible
     : public __and_<is_copy_constructible<_Tp>, 
 		    integral_constant<bool,
-			__is_trivially_constructible(_Tp, const _Tp&)>>::type
+			__is_trivially_constructible(_Tp, const _Tp&)>>
     { };
   
   /// is_trivially_move_constructible
@@ -1350,7 +1350,7 @@ 
     struct is_trivially_move_constructible
     : public __and_<is_move_constructible<_Tp>, 
 		    integral_constant<bool,
-			__is_trivially_constructible(_Tp, _Tp&&)>>::type
+			__is_trivially_constructible(_Tp, _Tp&&)>>
     { };
 
   /// is_trivially_assignable
@@ -1358,7 +1358,7 @@ 
     struct is_trivially_assignable
     : public __and_<is_assignable<_Tp, _Up>, 
 		    integral_constant<bool,
-			__is_trivially_assignable(_Tp, _Up)>>::type
+			__is_trivially_assignable(_Tp, _Up)>>
     { };
 
   /// is_trivially_copy_assignable
@@ -1366,7 +1366,7 @@ 
     struct is_trivially_copy_assignable
     : public __and_<is_copy_assignable<_Tp>, 
 		    integral_constant<bool,
-			__is_trivially_assignable(_Tp&, const _Tp&)>>::type
+			__is_trivially_assignable(_Tp&, const _Tp&)>>
     { };
 
   /// is_trivially_move_assignable
@@ -1374,7 +1374,7 @@ 
     struct is_trivially_move_assignable
     : public __and_<is_move_assignable<_Tp>, 
 		    integral_constant<bool,
-			__is_trivially_assignable(_Tp&, _Tp&&)>>::type
+			__is_trivially_assignable(_Tp&, _Tp&&)>>
     { };
 
   /// is_trivially_destructible
@@ -1381,7 +1381,7 @@ 
   template<typename _Tp>
     struct is_trivially_destructible
     : public __and_<is_destructible<_Tp>, integral_constant<bool,
-			      __has_trivial_destructor(_Tp)>>::type
+			      __has_trivial_destructor(_Tp)>>
     { };
 
   /// has_trivial_default_constructor (temporary legacy)