名前空間
変種
操作

std::forward_as_tuple

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

 
 
ユーティリティライブラリ
支援を入力します (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::tuple
メンバ関数
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.
tuple::tuple
tuple::operator=
tuple::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_tuple
tie
forward_as_tuple
None
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get
ヘルパークラス
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
uses_allocator
ignore
 
Defined in header <tuple>
template< class... Types >
tuple<Types...> forward_as_tuple( Types&&... args );
(C + + 11以来)
関数への引数として転送するのに適しargsの引数への参照のタプルを構築します。タプルは右辺値が引数として使用されているとき右辺値参照データメンバを持つ、それ以外は左辺値参照データメンバを持っています。右辺値が使用されている場合、この関数の結果は次のシーケンスポイントの前に消費しなければならない.
Original:
Constructs a tuple of references to the arguments in args suitable for forwarding as an argument to a function. The tuple has rvalue reference data members when rvalues are used as arguments, and otherwise has lvalue reference data members. If rvalues are used, the result of this function must be consumed before the next sequence point.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

args -
からタプルを構築するためにゼロ個以上の引数
Original:
zero or more arguments to construct the tuple from
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

std::tupleオブジェクトはstd::tuple<Types&&...>(std::forward<Types>(args)...)たかのように作成しました
Original:
A std::tuple object created as if by std::tuple<Types&&...>(std::forward<Types>(args)...)
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 <map>
#include <tuple>
#include <string>
 
int main()
{
    std::map<int, std::string> m;
 
    // same as m.emplace(10, 20, 'a');
    m.emplace(std::forward_as_tuple(10, std::string(20, 'a')));
    std::cout << "m[10] = " << m[10] << '\n';
 
    // The following is an error: it produces a
    // std::tuple<int&&, std::string&&> holding two dangling references.
    //
    // auto t = std::forward_as_tuple(10, std::string(20, 'a'));
    // m.emplace(t);
}

Output:

m[10] = aaaaaaaaaaaaaaaaaaaa
引数の型で定義された型のtupleオブジェクトを作成します
Original:
creates a tuple object of the type defined by the argument types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート) [edit]
左辺値参照またはアンパックのtupleは、個々のオブジェクトにタプルが作成されます
Original:
creates a tuple of lvalue references or unpacks a tuple into individual objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(関数テンプレート) [edit]
タプルの任意の番号を連結することによってtupleを作成します
Original:
creates a tuple by concatenating any number of tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

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