Why can't member function of vector be used, when i am using them on vector a class..
for instance
I have this class.
1 2 3 4 5 6 7 8 9 10 11 12 13
Class Test
{
public:
vector<pair<int,int>> limeJuice;
~Test()
void merge(test &B)
{
limeJuice.insert(limeJuice.end(),B.limeJuice.begin(),B.limeJuice.end());
};
};
In my main i have a vector <TEST> test_Objects;
when i call test_Objects.insert, or test_Objects.erase, i get the message that there is no member function to call..
I assume you mean: vector <Test> test_Objects;
C++ is case sensitive.
When you post a problem, a compilable snippet is appreciated, along with the exact text of the error you're getting. After making the above corrections, this compiles for me:
> but the iterator itself isn't it an integer?
no. Iterators are used to traverse a container, and for that they have operations like getelement() and advance() ¿how do you expect 42.next() to work? ¿which container would be related to?
> possible to make it an iterator in some way?
yes, there are a lot of way.
¿what are you trying to accomplish?
¿what would be the result of doing test_Objects.insert(j+1,i+1,test_Objects.end())?