名前空間
変種
操作

std::get(std::pair)

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

 
 
ユーティリティライブラリ
支援を入力します (basic types, RTTI, type traits)
動的なメモリ管理
エラー処理
プログラムユーティリティ
可変個引数関数
日付と時刻
関数オブジェクト
initializer_list(C++11)
bitset
hash(C++11)
関係演算子
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
ペアとタプル
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
フォワード、スワップ、および移動
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
std::pair
メンバ関数
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.
pair::pair
pair::operator=
pair::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.
make_pair
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get(C++11)
ヘルパークラス
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(C++11)
tuple_element(C++11)
 
template< size_t N, class T1, class T2 >

typename std::tuple_element<I, std::pair<T1,T2> >::type&

    get( pair<T1, T2>& p );
(1) (C++11およびそれ以降)
template< size_t N, class T1, class T2 >

const typename std::tuple_element<I, std::pair<T1,T2> >::type&

    get( const pair<T1,T2>& p );
(2) (C++11およびそれ以降)
template< size_t N, class T1, class T2 >

typename std::tuple_element<I, std::pair<T1,T2> >::type&&

    get( std::pair<T1,T2>&& p );
(3) (C++11およびそれ以降)
タプルのようなインターフェイスを使用してペアから要素を抽出.
Original:
Extracts a element from the pair using tuple-like interface.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

p -
その内容を抽出するためのペア
Original:
pair 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-2)
戻りp.firstN==0p.secondN==1、IF.
Original:
Returns p.first if N==0 and p.second if N==1.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
戻りstd::forward<T1&&>(p.first)場合N==0std::forward<T2&&>(p.second)N==1場合
Original:
Returns std::forward<T1&&>(p.first) if N==0 and std::forward<T2&&>(p.second) if N==1
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 例外

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

[編集]

#include <iostream>
#include <utility>
 
int main()
{
    auto p = std::make_pair(1, 3.14);
    std::cout << '(' << std::get<0>(p) << ", " << std::get<1>(p) << ')' << std::endl;
}

Output:

(1, 3.14)


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

タプルは、指定された要素にアクセスします
Original:
tuple accesses specified element
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート) [edit]
accesses an element of an array
(関数テンプレート) [edit]