// A slightly more realistic use of type selection. #include #include // Conditional is a syntactial embellishment of the application of underlying conditional template. // We are using a template alias: template using Conditional = typename std::conditional::type; constexpr long int LIMIT = 5000; constexpr bool large(int n){ return n > LIMIT; } int main() { using namespace std; const long int SZ = 1234; using FloatingPointT = Conditional; // select type - float is selected in this // particular context. FloatingPointT x = 1234.5678; cout << "sizeof(double) = " << sizeof(double) << endl; // 8 cout << "sizeof(float) = " << sizeof(float) << endl; // 4 cout << "sizeof(FloatingPointT) = " << sizeof(FloatingPointT) << endl; // 4 return 0; }