Pedro.Alonso
Pedro.Alonso

Reputation: 1005

std::vector insert error

I have a vector code in c++ this:

typedef  vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> >::iterator traveling;
traveling running = 
std::partition( wait.begin(), wait.end(), tuple_comp    );
running_jobs.insert(running, wait.end());
wait.erase( running, wait.end() );

And this error is giving me:

main.cpp:223: error: no matching function for call to ‘std::vector<boost::tuples::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, std::allocator<boost::tuples::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >
>::insert(threaded_function(ppa::Model_factory&, ppa::Node*)::traveling&,
__gnu_cxx::__normal_iterator<boost::tuples::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>*, std::vector<boost::tuples::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>, std::allocator<boost::tuples::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > >)’

This is netbeans 7.2, I don't know vector in std is supposed to have insert, am I missing something?

running_jobs = vector<boost::tuple<ppa::Node*, ppa::Node*, ppa::Node*, bool> > running_jobs;

 line 223    running_jobs.insert(running, wait.end());

Upvotes: 1

Views: 3711

Answers (2)

log0
log0

Reputation: 10917

The problem is indeed your call to insert. Take a look at
http://www.cplusplus.com/reference/stl/vector/insert/

You must tell insert where to insert into running_jobs. probably something like:

running_jobs.insert(running_jobs.end(), running, wait.end());

Upvotes: 3

Moataz Elmasry
Moataz Elmasry

Reputation: 2519

what is running_jobs?I take it its a vector. also the object "wait" I assume its a vector

for the call

running_jobs.insert(running, wait.end());

is wrong. first param must be the iterator so the right call should be

running_jobs.insert( wait.end(), running);

hope this works

Upvotes: 1

Related Questions