Contributor
Currently, const_reference and const charT& are mixedly used in the return types of some functions in [strings] (same for non-const versions).
This PR consistently
- spells the return types in the short aliased forms, as the shorter forms are clearer, and
- aligns non-const and const overloads of
basic_string::data, and - spells the shorter form for the type of
basic_string_view::data_.
Member
We should better close this; it's not a good idea.
Note that https://eel.is/c++draft/sequence.reqmts#itemdecl:33 is worded to result in reference, and you're suggesting to make it inconsistent with the sequence container requirements by spelling it out as charT&.
Contributor Author
Note that https://eel.is/c++draft/sequence.reqmts#itemdecl:33 is worded to result in
reference, and you're suggesting to make it inconsistent with the sequence container requirements by spelling it out ascharT&.
Do you mean that we should change to spell (const_)reference as the return types of basic_string's front and back?
Moreover, I don't think consistency with "sequence container requirements" applies to basic_string_view.
Member
Do you mean that we should change to spell
(const_)referenceas the return types ofbasic_string'sfrontandback?
Yes, that seems better than changing it the other way around. That way it would be reference and const_reference everywhere.
Moreover, I don't think consistency with "sequence container requirements" applies to
basic_string_view.
basic_string_view still implements the "string protocol", so it should be consistent with basic_string, which in turn, should be consistent with sequence container requirements.
Contributor Author
Do you mean that we should change to spell
(const_)referenceas the return types ofbasic_string'sfrontandback?Yes, that seems better than changing it the other way around. That way it would be
referenceandconst_referenceeverywhere.Moreover, I don't think consistency with "sequence container requirements" applies to
basic_string_view.
basic_string_viewstill implements the "string protocol", so it should be consistent withbasic_string, which in turn, should be consistent with sequence container requirements.
OK. I'll open another PR for spelling consistency and close this.