make_pair (STL/CLR)

从一对值执行 pair。

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

参数

  • Value1
    第一个包装值的类型。

  • Value2
    第二个包装值的类型。

  • first
    包装的第一个值。

  • 第二个
    其次包装的值。

备注

模板函数返回 pair<Value1, Value2>(first, second)。 使用它通过一对键值构造 pair<Value1, Value2> 对象。

示例

// 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); 
    } 
 
  

要求

标头: <cliext/utility>

命名空间: cliext

请参见

参考

range_adapter (STL/CLR)