Namespaces
Variants

Template talk:cpp/container/end

From cppreference.com

Complexity

I suspect that end has linear complexity for forward_list -- does anybody disagree? --Nate 14:05, 14 June 2012 (PDT)

Why linear? The iterator returned by end() doesn't refer to an actual element. It should be possible to implement the function to return a static value. -- P12 14:14, 14 June 2012 (PDT)
You're right, never mind. I was confusing end with the linear behavior of std::distance(lst.begin(), lst.end()) for a forward_list. --Nate 17:10, 14 June 2012 (PDT)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.