I want to try reversing a forward_list (without the reverse() method) but I'm not sure how to get rid of the last element after the erase_after() method without using resize().
#include<forward_list>
template<typename vt>
class reverse_forward_list{
public:
static void reverse(std::forward_list<vt>& list){
typename std::forward_list<vt>::iterator iter = list.begin();
int x = 0;
for(vt& i :list){
list.emplace_front(i);
x++;
}
list.erase_after(iter,list.end());
//list.resize(x);
}
};
Any help is appreciated