forward_list question

Jonathan Wakely jwakely.gcc@gmail.com
Tue Oct 30 22:50:00 GMT 2012


Next question, is there a reason some constructors use
_M_range_initialize and others manually copy all the elements?

It looks to me as though the allocator-extended copy constructor could
use _M_range_initialize(list.begin(), list.end()) and the
allocator-extended move constructor could use the same with
move_if_noexcept_iterator for the case where the allocators are not
equal.

Is the code in
_Fwd_list_base(const _Fwd_list_base& __lst, const _Node_alloc_type& __a)
and
_Fwd_list_base(_Fwd_list_base& __lst, const _Node_alloc_type& __a)
more efficient than the generic loop in _M_range_initialize that work
with any iterator type?  I'd be surprised.



More information about the Libstdc++ mailing list