Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[string.view] Remove unnecessary std:: prefixes. #1288

Closed
wants to merge 1 commit into from

Conversation

Eelis
Copy link
Contributor

@Eelis Eelis commented Dec 22, 2016

Same rationale as #1085.

The library provides implicit conversions from \tcode{const charT*} and \tcode{std::basic_string<charT, ...>} to \tcode{std::basic_string_view<charT, ...>} so that user code can accept just \tcode{std::basic_string_view<charT>} as a non-templated parameter wherever a sequence of characters is expected.
User-defined types should define their own implicit conversions to \tcode{std::basic_string_view} in order to interoperate with these functions.
The library provides implicit conversions from \tcode{const charT*} and \tcode{basic_string<charT, ...>} to \tcode{basic_string_view<charT, ...>} so that user code can accept just \tcode{basic_string_view<charT>} as a non-templated parameter wherever a sequence of characters is expected.
User-defined types should define their own implicit conversions to \tcode{basic_string_view} in order to interoperate with these functions.
\end{note}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... This is a note explaining how to interoperate with string views in user code. Assuming no "using namespace std" is present, user code would need the std:: prefix when mentioning basic_string_view.

On the other hand, talking about basic_string_view<charT> as a "non-templated parameter" certainly means this is not verbatim user code (because charT is used as a template parameter in this section).

Net result: I'm fine with the proposed change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had similar misgivings about this change. Since it's in a note, and it is talking about user code (implicitly using charT as a user-chosen parameter), I'd be happy with the status quo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tkoeppe: That applies to the last 2 of the 4 removals, right? If so, would the patch be more acceptable to you if it only removed the first 2 occurrences?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eelis: Changing the std:: convention mid-sentence seems like the worst of all options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jensmaurer It's not "changing the convention" if the convention is "no prefix unless the occurrence in question is describing user code" and if only the last two occurrences in the sentence describe user code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Eelis: Agreed, but it looks really odd to have the same standard library name prefixed by std:: and not prefixed in the same sentence. (That would be the result with your "2 of 4" proposal.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me close this PR in the interest of not diluting attention too much for what are basically subjective issues. Feel free to reopen if you feel really strongly, but in that case I'd leave this for the project editor to process.

@tkoeppe tkoeppe closed this Dec 30, 2016
@tkoeppe tkoeppe reopened this Dec 30, 2016
@tkoeppe tkoeppe closed this Dec 30, 2016
@Eelis Eelis deleted the stdprefix branch July 3, 2020 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants