On the recently introduced to C++20 Ranges, I know that views achieve composability by using view adaptors. I also know that views don't own their elements and that their nature is lazy, that is to say they only do the actual computation when it's needed.
How do views achieve O(1) complexity on move, copy and assign operations though? The probable answer that comes to me is, views being just descriptions of "to be computed" operations, they just refer to the data and their transformations.
That, though, sounds like views are just taking on the job of expressing our coding sequences and only when passed to some eager thing (e.g. an algorithm) do they manifest all the computational load in this particular, single call.
Follow up question: I can understand how one would achieve a O(1) copy, in the essence of referring to the copiable object (although I don't know if that's what ranges::views do). But I cannot understand how this will work in assignment operations. Again, a probable answer would be, since all these happen in compile time, then again just "describing" the assignment is an O(1) operation. But mutating an std::vector<int> that's viewed by a view, is a runtime operation instead (great example). Is this still an O(1) operation?