Group Logical Values
Tags for representing true and false.

Grouped Tags Overview

Detailed Description


Print the values of the tags/metafunctions True and False.

    std::cout << False::VALUE << "\n"                                         // => "0"
              << True::VALUE << "\n"                                          // => "1"
              << IsSameType<False, False::Type>::VALUE << "\n"; // => "1"

Inheriting from True and False

The two tags True and False have the special property that they can also be used as metafunctions and both have a VALUE as well as a TYPE. This property makes it very convenient to define metafunctions by inheriting from the True or False.

template <typename T>
struct IsInt32 :
    False {};

template <>
struct IsInt32<int>:
    True {};

The metafunction IsInt32 can now be used as follows.

    std::cout << IsInt32<bool>::VALUE << "\n"  // => "0"
              << IsInt32<int>::VALUE << "\n";  // => "1"

Grouped Tags Detail

struct False; False::Type; bool False::VALUE = false;

Defined in
Representation for False.

struct True; True::Type; bool True::VALUE = true;

Defined in
Representation for True.