Namespaces
Variants

std:: is_bounded_array

From cppreference.net
Metaprogramming library
Type traits
Type categories
(C++11)
(C++11) ( DR* )
Type properties
(C++11)
(C++11)
(C++14)
(C++11) (deprecated in C++26)
(C++11) ( until C++20* )
(C++11) (deprecated in C++20)
(C++11)
is_bounded_array
(C++20)
Type trait constants
Metafunctions
(C++17)
Supported operations
Relationships and property queries
Type modifications
Type transformations
(C++11) (deprecated in C++23)
(C++11) (deprecated in C++23)
(C++11)
(C++11) ( until C++20* ) (C++17)

Compile-time rational arithmetic
Compile-time integer sequences
헤더에 정의됨 <type_traits>
template < class T >
struct is_bounded_array ;
(C++20부터)

std::is_bounded_array UnaryTypeTrait 입니다.

T 가 알려진 경계를 가진 배열 타입인지 확인합니다. T 가 알려진 경계를 가진 배열 타입인 경우 멤버 상수 value true 와 같도록 제공합니다. 그렇지 않은 경우, value false 와 같습니다.

프로그램이 std::is_bounded_array 또는 std::is_bounded_array_v 에 대한 특수화를 추가하는 경우, 그 동작은 정의되지 않습니다.

목차

템플릿 매개변수

T - 확인할 타입

헬퍼 변수 템플릿

template < class T >
constexpr bool is_bounded_array_v = is_bounded_array < T > :: value ;
(C++20부터)

std:: integral_constant 로부터 상속됨

멤버 상수

value
[static]
true 만약 T 가 알려진 경계를 가진 배열 타입이면, false 그렇지 않으면
(public static member constant)

멤버 함수

operator bool
객체를 bool 로 변환, value 반환
(public member function)
operator()
(C++14)
value 반환
(public member function)

멤버 타입

타입 정의
value_type bool
type std:: integral_constant < bool , value >

가능한 구현

template<class T>
struct is_bounded_array : std::false_type {};
template<class T, std::size_t N>
struct is_bounded_array<T[N]> : std::true_type {};

참고 사항

기능 테스트 매크로 표준 기능
__cpp_lib_bounded_array_traits 201902L (C++20) std::is_bounded_array , std::is_unbounded_array

예제

#include <iostream>
#include <type_traits>
#define OUT(...) std::cout << #__VA_ARGS__ << " : " << __VA_ARGS__ << '\n'
class A {};
int main()
{
    std::cout << std::boolalpha;
    OUT(std::is_bounded_array_v<A>);
    OUT(std::is_bounded_array_v<A[]>);
    OUT(std::is_bounded_array_v<A[3]>);
    OUT(std::is_bounded_array_v<float>);
    OUT(std::is_bounded_array_v<int>);
    OUT(std::is_bounded_array_v<int[]>);
    OUT(std::is_bounded_array_v<int[3]>);
}

출력:

std::is_bounded_array_v<A> : false
std::is_bounded_array_v<A[]> : false
std::is_bounded_array_v<A[3]> : true
std::is_bounded_array_v<float> : false
std::is_bounded_array_v<int> : false
std::is_bounded_array_v<int[]> : false
std::is_bounded_array_v<int[3]> : true

참고 항목

(C++11)
타입이 배열 타입인지 확인합니다
(클래스 템플릿)
타입이 경계를 알 수 없는 배열 타입인지 확인합니다
(클래스 템플릿)
(C++11)
지정된 차원을 따라 배열 타입의 크기를 얻습니다
(클래스 템플릿)