tags:

views:

494

answers:

3

Let's say that I've got a :

#include <utility>
using namespace std;
typedef pair<int, int> my_pair;

how do I initialize a const my_pair ?

+8  A: 

Use its constructor:

const my_pair p( 1, 2 );
anon
+1  A: 

const my_pair p = my_pair(3, 2);

Ivan
+2  A: 
const my_pair p = std::make_pair( 2, 3);
Cătălin Pitiș