Are views really supposed to have strict 𝒪(1) destruction?
Mathias Stearn

Created on 2020-06-16.00:00:00 last changed 5 months ago


Date: 2020-06-15.00:00:00

[ 2020-06-26; Reflector prioritization ]

Set priority to 2 after reflector discussions.

Date: 2020-06-20.22:01:58

The second bullet of [range.view] paragraph 3 says "Examples of views are:[…] A range type that holds its elements by shared_ptr and shares ownership with all its copies". That clearly does not have 𝒪(1) destruction in all cases. However, that does seem like a useful type of view, and is related to the discussions around the proposed std::generator.

What is the purpose of requiring 𝒪(1) destruction? Would it still be achieved by weakening it slightly to something like "If N copies and/or moves are made from a view that yields M values, destroying all of them takes time proportional to at worst 𝒪(N+M)"? This in particular prevents the 𝒪(N*M) case that I think the rules are trying to prevent, while still allowing some more interesting types of views.

If instead we actually really do want strict 𝒪(1) destruction, then the example needs to be fixed.

Date User Action Args
2020-06-26 11:48:00adminsetmessages: + msg11344
2020-06-16 00:00:00admincreate