名前空間
変種
操作

std::tie

提供: 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&...> tie( Types&... args );
(C++11およびそれ以降)
std::ignoreのその引数やインスタンスに左辺値参照のタプルを作成.
Original:
Creates a tuple of lvalue references to its arguments or instances of std::ignore.
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 lvalue 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.

[編集] 値を返します

左辺値referenesを含むstd::tupleオブジェクト.
Original:
A std::tuple object containing lvalue referenes.
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およびそれ以降)

[編集]

std::tieは、structとの比較を辞書式またはタプルをアンパックするために導入するために使用することができます
Original:
std::tie can be used to introduce lexicographical comparison to a struct or to unpack a tuple:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <string>
#include <set>
#include <tuple>
 
struct S {
    int n;
    std::string s;
    float d;
    bool operator<(const S& rhs) const
    {
        // compares n to rhs.n,
        // then s to rhs.s,
        // then d to rhs.d
        return std::tie(n, s, d) < std::tie(rhs.n, rhs.s, rhs.d);
    }
};
 
int main()
{
    std::set<S> set_of_s; // S is LessThanComparable
 
    S value{42, "Test", 3.14};
    std::set<S>::iterator iter;
    bool inserted;
    // unpacks the return value of insert into iter and inserted
    std::tie(iter, inserted) = set_of_s.insert(value);
    if(inserted)
        std::cout << "Value was inserted sucessfully\n";
}

Output:

Value was inserted sucessfully
引数の型で定義された型の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 rvalue references
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]
プレースホルダを使用してtupletieを展開する時に要素をスキップする
Original:
placeholder to skip an element when unpacking a tuple using tie
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(定数) [edit]