Namespaces
Variants
Views
Actions

Talk:cpp/container/forward list/before begin

From cppreference.com

[edit] Initialization and comparison

What about the use case of initializing an iterator to before_begin and then comparing to see if it has moved; i.e. do two before_begin's compare equal and if you subtract one from begin, will it become equal to before_begin? Kumiponi (talk) 06:50, 19 October 2014 (PDT)

You can't subtract one from a forward_list iterator, it's not bidirectional. Also before_begin is not a singular iterator, two before_begins only compare equal if they were obtained from the same forward_list by calling .before_begin()/.cbefore_begin() and no iterator-invalidating events took place since then. --Cubbi (talk) 07:41, 19 October 2014 (PDT)