std:: tuple_size <std::array>
|
ヘッダーで定義
<array>
|
||
|
template
<
class
T,
std::
size_t
N
>
struct
tuple_size
<
std::
array
<
T, N
>
>
:
|
(C++11以降) | |
std::array の要素数へのアクセスを、コンパイル時定数式として提供します。
目次 |
ヘルパー変数テンプレート
|
template
<
class
T
>
constexpr std:: size_t tuple_size_v = tuple_size < T > :: value ; |
(C++17以降) | |
std:: integral_constant から継承
メンバ定数
|
value
[static]
|
N
、配列内の要素数
(public static member constant) |
メンバ関数
|
operator std::size_t
|
オブジェクトを
std::
size_t
に変換、
value
を返す
(public member function) |
|
operator()
(C++14)
|
value
を返す
(public member function) |
メンバ型
| 型 | 定義 |
value_type
|
std:: size_t |
type
|
std:: integral_constant < std:: size_t , value > |
例
#include <array> int main() { auto arr = std::to_array("ABBA"); static_assert(std::tuple_size<decltype(arr)>{} == 5); }
関連項目
| Structured binding (C++17) | 指定された名前を初期化子の部分オブジェクトまたはタプルの要素にバインドする |
|
(C++11)
|
タプルライクな型の要素数を取得する
(クラステンプレート) |
|
(C++11)
|
タプルのサイズを取得する
|
|
(C++11)
|
pair
のサイズを取得する
(クラステンプレートの特殊化) |
|
std::ranges::subrange
のサイズを取得する
(クラステンプレートの特殊化) |