Add const_iterable_sequence concept #154
Merged
+265
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For a sequence S,
const_iterable_sequence<S>
means we can useS const
as a sequence with the expected semantics.Specifically, we require that:
S const
is a sequenceS
andS const
have the same cursor type and the same value typeS
andS const
have the sameconst_element_type
multipass
,bidirectional
etc), excludingread_only_sequence
, bothS
andS const
must satisfy the concept or both must not satisfy the concept. For example, ifS
is bidirectional thenS const
must be bidirectional and vice versaS
modelsread_only_sequence
thenS const
must modelread_only_sequence
-- that is,S const
may strengthen the const-qualification of elements but not weaken itS const
yields "the same elements" as iterating overS
(but let's gloss over exactly how we define "same"...)We've previously assumed all of these things are true (except possibly the
const_element_t
requirement), but it's good to have them checked by the compiler where we can.