[SG10] Updated SD-6 draft

Jonathan Wakely cxx at kayari.org
Thu Aug 4 14:28:21 CEST 2016


Example for P0013R1 __cpp_lib_logical_traits

template<typename... T>
  using condition =
#if __cpp_lib_logical_traits
  conjunction<is_pointer<decay_t<T>>...>;
#else
  bool_constant<(is_pointer<decay_t<T>>::value && ...)>;
#endif

template<typename... T>
  enable_if_t<condition<T...>::value>
  foo(T&&...) { }

template<typename... T>
  enable_if_t<!condition<T...>::value>
  foo(T&&...) { }

Using conjunction is more efficient at compile-time, because it short
circuits and doesn't evaluate every expression in the pack expansion
if it doesn't need to.


More information about the Features mailing list