Bagikan melalui


Typedefs <type_traits>

false_type
true_type

typedef false_type

Menyimpan konstanta integral dengan nilai palsu.

typedef integral_constant<bool, false> false_type;

Keterangan

Jenisnya adalah sinonim untuk spesialisasi templat integral_constant.

Contoh

#include <type_traits>
#include <iostream>

int main() {
    std::cout << "false_type == " << std::boolalpha
        << std::false_type::value << std::endl;
    std::cout << "true_type == " << std::boolalpha
        << std::true_type::value << std::endl;

    return (0);
}
false_type == false
true_type == true

true_type Typedef

Menyimpan konstanta integral dengan nilai benar.

typedef integral_constant<bool, true> true_type;

Keterangan

Jenisnya adalah sinonim untuk spesialisasi templat integral_constant.

Contoh

// std__type_traits__true_type.cpp
// compile with: /EHsc
#include <type_traits>
#include <iostream>

int main() {
    std::cout << "false_type == " << std::boolalpha
        << std::false_type::value << std::endl;
    std::cout << "true_type == " << std::boolalpha
        << std::true_type::value << std::endl;

    return (0);
}
false_type == false
true_type == true

Baca juga

<type_traits>