Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Constructs a pair object.
pair();
pair(pair<Coll>% right);
pair(pair<Coll>^ right);
pair(Value1 val1, Value2 val2);
Parameters
right
Pair to store.val1
First value to store.val2
Second value to store.
Remarks
The constructor:
pair();
initializes the stored pair with default constructed values.
The constructor:
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).
The constructor:
pair(Value1 val1, Value2 val2);
initializes the stored pair with with val1 and val2.
Example
// 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);
}
[\0, 0] [x, 3] [x, 3] [x, 3]
Requirements
Header: <cliext/utility>
Namespace: cliext