名前空間
変種
操作

std::get(std::tuple)

提供: cppreference.com
< cpp‎ | utility‎ | tuple

template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type&

    get( tuple<Types...>& t );
(1) (C++11およびそれ以降)
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type&&

    get( tuple<Types...>&& t );
(2) (C++11およびそれ以降)
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type const&

    get( const tuple<Types...>& t );
(3) (C++11およびそれ以降)
タプルからIth要素の要素を抽出します。 I[0, sizeof...(Types))の整数値です.
Original:
Extracts the Ith element element from the tuple. I is an integer value in [0, sizeof...(Types)).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

t -
その内容を抽出するタプル
Original:
tuple whose contents to extract
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

1)
Itht要素への参照.
Original:
Reference to the Ith element of t.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
右辺値はItht要素への参照、要素は左辺値参照が返された場合で、左辺値参照型でない限り.
Original:
Rvalue reference to the Ith element of t, unless the element is of lvalue reference type, in which case lvalue reference is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Itht要素へのconst参照.
Original:
Const reference to the Ith element of t.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 例外

noexcept specification:  
noexcept
  (C++11およびそれ以降)

[編集]

#include <iostream>
#include <string>
#include <tuple>
 
int main()
{
    auto t = std::make_tuple(1, "Foo", 3.14);
    std::cout << "(" << std::get<0>(t) << ", " << std::get<1>(t)
              << ", " << std::get<2>(t) << ")\n";
}

出力:

(1, Foo, 3.14)

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

accesses an element of an array
(関数テンプレート) [edit]
pairの要素にアクセスします
Original:
accesses an element of a pair
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート) [edit]