名前空間
変種
操作

std::numeric_limits<T>::is_integer

提供: cppreference.com
 
 
ユーティリティライブラリ
汎用ユーティリティ
日付と時間
関数オブジェクト
書式化ライブラリ (C++20)
(C++11)
関係演算子 (C++20で非推奨)
整数比較関数
(C++20)
スワップと型操作
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
一般的な語彙の型
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

初等文字列変換
(C++17)
(C++17)
 
型サポート
型の性質
(C++11)
(C++11)
(C++14)
(C++11)
(C++11)(C++20未満)
(C++11)(C++20で非推奨)
(C++11)
型特性定数
メタ関数
(C++17)
定数評価文脈
サポートされている操作
関係と性質の問い合わせ
型変更
(C++11)(C++11)(C++11)
型変換
(C++11)
(C++11)
(C++17)
(C++11)(C++20未満)(C++17)
 
 
static const bool is_integer;
(C++11未満)
static constexpr bool is_integer;
(C++11以上)

std::numeric_limits<T>::is_integer の値は、すべての整数算術型に対しては true になり、そうでなければ false になります。 この定数はすべての特殊化について意味があります。

[編集] 標準の特殊化

T std::numeric_limits<T>::is_integer の値
/* 非特殊化 */ false
bool true
char true
signed char true
unsigned char true
wchar_t true
char8_t (C++20) true
char16_t (C++11) true
char32_t (C++11) true
short true
unsigned short true
int true
unsigned int true
long true
unsigned long true
long long (C++11) true
unsigned long long (C++11) true
float false
double false
long double false

[編集]

#include <cstddef>
#include <cstdint>
#include <numeric>
 
int main()
{
    static_assert(
            std::numeric_limits<bool>::is_integer
        &&  std::numeric_limits<std::size_t>::is_integer
        &&  std::numeric_limits<std::int32_t>::is_integer
        &&  std::numeric_limits<std::int64_t>::is_integer
        &&  std::numeric_limits<decltype(42)>::is_integer
        && !std::numeric_limits<float>::is_integer
        && !std::numeric_limits<double>::is_integer
        && !std::numeric_limits<long double>::is_integer
        && !std::numeric_limits<decltype([](){})>::is_integer // P0315R4
    );
}


[編集] 関連項目

型が整数型かどうか調べます
(クラステンプレート) [edit]
[静的]
符号付きの型を識別します
(パブリック静的メンバ定数) [edit]
[静的]
正確な型を識別します
(パブリック静的メンバ定数) [edit]
[静的]
値の有限集合を表現する型を識別します
(パブリック静的メンバ定数) [edit]