std::conditional (3) - Linux Manuals
std::conditional: std::conditional
NAME
std::conditional - std::conditional
Synopsis
Defined in header <type_traits>
template< bool B, class T, class F > (since C++11)
struct conditional;
Provides member typedef type, which is defined as T if B is true at compile time, or as F if B is false.
Member types
Member type Definition
type T if B == true, F if B == false
Helper types
template< bool B, class T, class F > (since C++14)
using conditional_t = typename conditional<B,T,F>::type;
Possible implementation
Example
// Run this code
Possible output:
See also
enable_if hides a function overload or template specialization based on compile-time boolean
(C++11)