, . , ::type 2 (bool , ).
, , , , . .
template<template<class...>class Target>struct defer{
template<class...Ts>using execute=Target<Ts...>;
};
template<class T>struct sink{
template<class...>using execute=T;
};
template< class Prog, class... Ts > using run=Prog::template execute<Ts...>;
using choice = typename std::conditional< test, defer<Foo>, sink< std::false_type > >::type;
using result = run< choice, int, double >;
, a defer d Foo, sink d false_type. , Foo<int, double>, false_type.
sink execute , defer template.
, Foo<int, double> , test , choice sink<false_type>!
template<bool b, class A, class B, class...Ts>
using pick = run< typename std::conditional< b, A, B >::type, Ts... >;
using result=pick<test, defer<Foo>, sink<std::false_type>, int, double >;
, choice/result .
, if:
static constexpr bool value =
typename std::conditional< sizeof...( Args ),
pick< std::is_same< T, Y >::value,
defer<isSame>,
sink<std::false_type>,
Y, Args...
>,
std::is_same< T, Y >
>::type::value;
, , .