Namespaces
Variants

std:: is_unbounded_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_unbounded_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
Definiert im Header <type_traits>
template < class T >
struct is_unbounded_array ;
(seit C++20)

std::is_unbounded_array ist ein UnaryTypeTrait .

Prüft, ob T ein Array mit unbekannter Grenze ist. Stellt die Member-Konstante value bereit, die gleich true ist, falls T ein Array-Typ mit unbekannter Grenze ist. Andernfalls ist value gleich false .

Wenn das Programm Spezialisierungen für std::is_unbounded_array oder std::is_unbounded_array_v hinzufügt, ist das Verhalten undefiniert.

Inhaltsverzeichnis

Template-Parameter

T - ein zu prüfender Typ

Hilfsvariablen-Template

template < class T >
constexpr bool is_unbounded_array_v = is_unbounded_array < T > :: value ;
(seit C++20)

Geerbt von std:: integral_constant

Member-Konstanten

value
[static]
true wenn T ein Array-Typ mit unbekannter Grenze ist, false andernfalls
(öffentliche statische Member-Konstante)

Member-Funktionen

operator bool
konvertiert das Objekt zu bool , gibt value zurück
(öffentliche Member-Funktion)
operator()
(C++14)
gibt value zurück
(öffentliche Member-Funktion)

Member-Typen

Typ Definition
value_type bool
type std:: integral_constant < bool , value >

Mögliche Implementierung

template<class T>
struct is_unbounded_array: std::false_type {};
template<class T>
struct is_unbounded_array<T[]> : std::true_type {};

Hinweise

Feature-Test Makro Wert Std Feature
__cpp_lib_bounded_array_traits 201902L (C++20) std::is_bounded_array , std::is_unbounded_array

Beispiel

#include <type_traits>
class A {};
static_assert
(""
    && std::is_unbounded_array_v<A> == false
    && std::is_unbounded_array_v<A[]> == true
    && std::is_unbounded_array_v<A[3]> == false
    && std::is_unbounded_array_v<float> == false
    && std::is_unbounded_array_v<int> == false
    && std::is_unbounded_array_v<int[]> == true
    && std::is_unbounded_array_v<int[3]> == false
);
int main() {}

Siehe auch

(C++11)
prüft, ob ein Typ ein Array-Typ ist
(Klassentemplate)
prüft, ob ein Typ ein Array-Typ mit bekannter Grenze ist
(Klassentemplate)
(C++11)
ermittelt die Größe eines Array-Typs entlang einer bestimmten Dimension
(Klassentemplate)