Translations of this page?:

make_pair

文法:

  pair<T1,T2> make_pair( const T1 &a, const T2 &b );

make_pair関数はabの2つのデータを含む1つのオブジェクトを返却します。make_pairはpairクラスのインスタンスを手早く生成するために使用できます。

例:

#include <string>
using std::string;
#include <iostream>
using std::cout;
#include <utility>
using std::pair;
using std::make_pair;
 
int main () {
  pair<int,string> tuple = make_pair( 42, "The answer" );
 
  cout << "tuple.first: " << tuple.first
       << ", tuple.second: " << tuple.second << '\n';
 
  return 0;
}
 
• • • SitemapRecent changesRSScc