Top "Std-pair" questions

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

How would one push back an empty vector of pairs to another vector?

std::vector<std::vector< std::pair<int, int> > > offset_table; for (int i = 0; i &…

c++ vector std-pair push-back
ISO C++ forbids declaration of ‘tuple’ with no type

When trying to compile a simple class (g++ myclass.cpp), I get the following error: ISO C++ forbids declaration of ‘…

c++ g++ tuples std std-pair
Sorting a std::vector<std::pair<std::string,bool>> by the string?

How can I sort this vector by comparing the pair.first which is an std::string? (without providing a static …

c++ sorting stl vector std-pair
C++ pairs and pointers

I don't know what can I do to make this work in C++. The intend is: pair<int, int&…

c++ pointers std-pair
Why is std::pair faster than std::tuple

Here is the code for testing. Tuple test: using namespace std; int main(){ vector<tuple<int,int>&…

performance c++11 std-pair stdtuple
How should I brace-initialize an std::array of std::pairs?

std::array<std::pair<int, int>, 2> ids = { { 0, 1 }, { 1, 2 } }; VS2013 error: error C2440: 'initializing' : cannot convert from 'int' …

c++ c++11 std-pair stdarray list-initialization
find_if and std::pair, but just one element

Suppose i have the following code: std::vector< std::pair <int, char> > myVec; or std::list&…

c++ vector lambda iterator std-pair
Does there exist something like std::tie for std::pair?

Eg with tuples: #include <tuple> // std::tuple, std::make_tuple, std::tie int num; char letter; std::tuple&…

c++ c++11 std std-pair
Equivalent of C++ STL container "pair<T1, T2>" in Objective-C?

I'm new to Objective-C, so please don't judge me too much. I was wondering: Is there an equivalent of the …

iphone c++ objective-c stl std-pair
C++ set search for pair element?

So I have a set of pairs<string ,string> And I want to use find() to search for …

c++ search stl std-pair stdset