pair::pair (STL/CLR)
建構組物件。
pair();
pair(pair<Coll>% right);
pair(pair<Coll>^ right);
pair(Value1 val1, Value2 val2);
參數
right
要儲存組。val1
要儲存的第一個值。val2
第二個要儲存的值。
備註
建構函式:
pair();
初始化使用建構的預設值的預存的組。
建構函式:
pair(pair<Value1, Value2>% right);
initializes the stored pair with right.pair::first (STL/CLR) and right.pair::second (STL/CLR).
pair(pair<Value1, Value2>^ right);
initializes the stored pair with right->pair::first (STL/CLR) and right>pair::second (STL/CLR).
建構函式:
pair(Value1 val1, Value2 val2);
初始化與預存的組和val1和val2。
範例
// cliext_pair_construct.cpp
// compile with: /clr
#include <cliext/utility>
int main()
{
// construct an empty container
cliext::pair<wchar_t, int> c1;
System::Console::WriteLine("[{0}, {1}]",
c1.first == L'\0' ? "\\0" : "??", c1.second);
// construct with a pair of values
cliext::pair<wchar_t, int> c2(L'x', 3);
System::Console::WriteLine("[{0}, {1}]", c2.first, c2.second);
// construct by copying another pair
cliext::pair<wchar_t, int> c3(c2);
System::Console::WriteLine("[{0}, {1}]", c3.first, c3.second);
// construct by copying a pair handle
cliext::pair<wchar_t, int> c4(%c3);
System::Console::WriteLine("[{0}, {1}]", c4.first, c4.second);
return (0);
}
需求
標頭: < cliext/公用程式 >
Namespace: cliext