名前空間
変種
操作

std::tuple_size(std::array)

提供: cppreference.com
< cpp‎ | container‎ | array

 
 
 
std::array
メンバ関数
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
要素アクセスの循環参照を解除するために使用されている
Original:
Element access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::at
array::operator[]
array::front
array::back
array::data
イテレータ
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::begin
array::cbegin
array::end
array::cend
array::rbegin
array::crbegin
array::rend
array::crend
容量
Original:
Capacity
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::empty
array::size
array::max_size
修飾子
Original:
Modifiers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
array::fill
array::swap
非メンバ関数
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
get
swap
ヘルパークラス
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple_size
tuple_element
 
Defined in header <array>
template< class T, size_t N >

class tuple_size< array<T, N> > :
    public integral_constant<size_t, N>

{ };
(1) (C + + 11以来)
コンパイル時の定数式としてstd::array内の要素数へのアクセスを提供します.
Original:
Provides access to the number of elements in an std::array as a compile-time constant expression.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

Inherited from std::integral_constant

Member constants

value
[静的]
N, the number of elements in the array
(公共の静的メンバ定数)

Member functions

operator std::size_t
std::size_tにオブジェクトは、value返しに変換します
Original:
converts the object to std::size_t, returns value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(パブリックメンバ関数)

Member types

タイプ
Original:
Type
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Definition
value_type std::size_t
type std::integral_constant<std::size_t, value>

[編集]

#include <iostream>
#include <array>
 
template<class T>
void test(T t)
{
    int a[std::tuple_size<T>::value]; // can be used at compile time
    std::cout << std::tuple_size<T>::value << '\n';
}
 
int main()
{
    std::array<float, 3> arr;
    test(arr);
}

Output:

3

[編集] も参照してください

コンパイル時にtupleのサイズを取得します
Original:
obtains the size of tuple at compile time
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(クラステンプレートの特殊化の2つの値を比較します) [edit]