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
endwith the linear behavior ofstd::distance(lst.begin(), lst.end())for aforward_list. --Nate 17:10, 14 June 2012 (PDT)
- You're right, never mind. I was confusing