Hello,
I'm new in C++, and I have a small problem with filling a 2 columns and n rows vector with 2 variables:
1 2 3 4 5
for (ms::it i = _ms->starting (); i < _ms->ending (); i++)
{int x=(**i).ll;
double y=(**i).pp;
_final->adding (x,y);
std::vector< std::pair< int, double> >mytable;
So I've created a 2d vector " mytable" and I wish to fill it with parameters "x" and "y"...
I cant do a push_back using .first and .second ... I get an error saying:
first and second arent decalred.
This is not a 2D vector. This is a 1D vector. Each element in the 1D vector contains a std::pair object. If you're going to use this, you have to create each pair object and then push_back that pair object.
I just need something, that let me use the values in the array later in another function.
I think the std::pair object can do that and your example too.
Thanks for your code, I will test it.
Concerning your first reply, I cant push_back the pair object in the array... I've got an error each time. How can I do it?