Partager via


conditional Class

Selects one of two types, depending on the specified condition.

template<bool B, class Ty1, class Ty2>
    struct conditional;

template<bool _Test,class T1,class T2>
using conditional_t = typename conditional<_Test, T1, T2>::type;

Parameters

Parameter

Description

B

The value that determines the selected type.

Ty1

The type to evaluate.

Ty2

The type to evaluate.

Remarks

conditional<B, Ty1, Ty2>::type evaluates to Ty1 when B evaluates to true, and evaluates to Ty2 when B evaluates to false.

Requirements

Header: <type_traits>

Namespace: std

See Also

Reference

<type_traits>