Compartilhar via


make_pair (STL/CLR)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at make_pair (STL/CLR).

Make a pair from a pair of values.

Syntax

template<typename Value1,  
    typename Value2>  
    pair<Value1, Value2> make_pair(Value1 first, Value2 second);  

Parameters

Value1
The type of the first wrapped value.

Value2
The type of the second wrapped value.

first
First value to wrap.

second
Second value to wrap.

Remarks

The template function returns pair<``Value1``, Value2``>(``first``, second``). You use it to construct a pair``<``Value1``, Value2``> object from a pair of values.

Example

// cliext_make_pair.cpp   
// compile with: /clr   
#include <cliext/utility>   
  
int main()   
    {   
    cliext::pair<wchar_t, int> c1(L'x', 3);   
    System::Console::WriteLine("[{0}, {1}]", c1.first, c1.second);   
  
    c1 = cliext::make_pair(L'y', 4);   
    System::Console::WriteLine("[{0}, {1}]", c1.first, c1.second);   
    return (0);   
    }  
  
[x, 3]  
[y, 4]  

Requirements

Header: <cliext/utility>

Namespace: cliext

See Also

range_adapter (STL/CLR)