I know that std::forward_list is a single linked list. I'm wondering how to move the first element(head) to the end of the forward_list. No copies or creating new nodes!
I've tried the following:
std::forward_list<int> l2 = {10,11,12};
auto beginIt = l2.begin();
beginIt = std::next(beginIt);
l2.splice_after(l2.end(),l2,l2.begin(),beginIt);
for(int n : l2)
std::cout << n << ' ';
std::cout << '\n';
But it doesn't work. Is there a way to do that?