Namespaces
Variants

std::numeric_limits<T>::is_integer

cppreference.net에서
 
 
유틸리티 라이브러리
일반 유틸리티
관계 연산자 (C++20에서 폐지됨)
정수 비교 함수
(C++20)(C++20)(C++20)    
(C++20)
Swap 및 타입 연산
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
공통 어휘 타입
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
 
static const bool is_integer;
(C++11까지)
static constexpr bool is_integer;
(C++11부터)

std::numeric_limits<T>::is_integer의 값은 모든 정수 산술 타입true에 대해 T이고 그 외의 경우 false입니다. 이 상수는 모든 특수화에 대해 의미가 있습니다.

표준 특수화

T std:: numeric_limits < T > :: is_integer 의 값
/* non-specialized */ 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 <limits>
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<int*>::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
);
int main() {}

참고 항목

타입이 정수형인지 검사합니다
(클래스 템플릿)
[static]
부호 있는 타입을 식별합니다
(public static member constant)
[static]
정확한 타입을 식별합니다
(public static member constant)
[static]
유한한 값들의 집합을 나타내는 타입을 식별합니다
(public static member constant)