currently I am trying to understand how to move an element in Boost::ptr_list to the front.
I have been trying stuff like this:
boost::ptr_list<myObj> mylist;
boost::ptr_list<myObj> myiter;
// Do something useful
mylist.transfer(mylist.begin(), myiter, mylist);
This version the compiler acccepts, but my program crashes on the first call to transfer.
Another thing I tried was
mylist.push_front(mylist.release(myiter));
This the compiler rejects due to incompatible types.
What am I doing wrong? Thanks for your help.
I am assuming here you want to move the last element in the list to the front. If so here is one possible way to do it: