Top "Std-pair" questions

A std::pair is an ordered, heterogeneous sequence of exactly two objects (it is a special case of std::tuple).

STL map insertion efficiency: [] vs. insert

There are two ways of map insertion: m[key] = val; Or m.insert(make_pair(key, val)); My question is, …

c++ stl map insert std-pair
union members may not have constructors, but `std::pair` okay?

union members may not have destructors or constructors. So I can't template the following class Foo on my own MyClass …

c++ constructor unions std-pair
Is there a NULL equivalent for pairs in C++?

What would I want to use instead of NULL if I have an unassigned pair in C++? As an example, …

c++ std-pair
How to initialize a vector of pair of string,string in a c++ class?

How do I initialize a vector of a pair of strings in a C++ class? I tried several things but …

c++ c++11 vector initialization std-pair
why do i need to use piecewise_construct in map::emplace for single arg constructors of noncopyable objects?

The following code will not compile on gcc 4.8.2. The problem is that this code will attempt to copy construct an …

c++ c++11 map std-pair emplace
Why was pair range access removed from C++11?

I just discovered that at one point, the C++11 draft had std::begin/std::end overloads for std::pair that …

c++ foreach c++11 range std-pair
Using std::tie as a range for loop target

I want to do something like the following: //std::vector<std::pair<TypeA, TypeB>> someInitializingFunction(); { TypeA …

c++ for-loop language-lawyer std-pair tie
C++ feature, like std::set, which allows duplicates

I have an std::set, which stores std::pairs of two integers. The std::set is also sorted, by allowing …

c++ list c++11 std-pair stdset
std::pair assigning first and second to semantically named variables

There is a very popular question about "std::pair vs struct with two fields". But I have a question about …

c++ reference std-pair
map<string, vector <pair<int, int> > > pushing back into pair?

I have this map<string, vector <pair<int, int> > > variable and I'm pushing back …

c++ vector stdmap std-pair push-back