[PATCH] C++2a Utility functions to implement uses-allocator construction (P0591R4)

Jonathan Wakely jwakely@redhat.com
Fri Mar 1 14:33:00 GMT 2019


On 01/03/19 14:06 +0000, Jonathan Wakely wrote:
>+	  if constexpr (sizeof...(__args) == 0)
>+	    {
>+	      return std::make_tuple(piecewise_construct,
>+		  std::__uses_alloc_args<_Tp1>(__a),
>+		  std::__uses_alloc_args<_Tp2>(__a));
>+	    }
>+	  else if constexpr (sizeof...(__args) == 1)
>+	    {

If we want to ensure we only accept std::pair and not other pair-like
types, then this branch would need:

              static_assert((__is_pair<_Args>::value && ...));

>+	      return std::make_tuple(piecewise_construct,
>+		  std::__uses_alloc_args<_Tp1>(__a,
>+		    std::forward<_Args>(__args).first...),
>+		  std::__uses_alloc_args<_Tp2>(__a,
>+		    std::forward<_Args>(__args).second...));
>+	    }
>+	  else if constexpr (sizeof...(__args) == 2)



More information about the Gcc-patches mailing list