What’s the benefit of std::back_inserter over std::inserter?
Iterator types std::back_inserter returns std::back_insert_iterator that uses Container::push_back(). std::inserter returns std::insert_iterator that uses Container::insert(). std::list For lists std::list::push_back is almost the same as std::list::insert. The only difference is that insert returns iterator to inserted element. bits/stl_list.h void push_back(const value_type& __x) { this->_M_insert(end(), __x); } void _M_insert(iterator __position, const value_type& __x) { _Node* __tmp = _M_create_node(__x); … Read more