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

Containers: add StringView overload for known sizes #155

Closed
wants to merge 1 commit into from

Conversation

sthalik
Copy link
Contributor

@sthalik sthalik commented Nov 10, 2022

Is this a reasonable compromise between support for unterminated strings and the need for a constexpr constructor?

@sthalik
Copy link
Contributor Author

sthalik commented Nov 10, 2022

Actually this isn't a good idea. I forgot about you mentioning operator""_s.

@sthalik sthalik closed this Nov 10, 2022
@mosra
Copy link
Owner

mosra commented Nov 10, 2022

Just for the record, as we discussed this on Gitter extensively:

I plan to have a constexpr constructor relying on compiler-specific magic, such as the one that's used to implement constexpr construction of std::string_view. But, due to the compiler-specific magic, only as an optional "nice to have" optimization that removes the need for runtime strlen() even when _s literals are not used, not something people should rely on.

For constexpr creation from arrays I plan to update the ArrayView construxctor to be constexpr, as detailed in #123, when I figure out how without adding a header dependency.

@mosra mosra added the scrapped label Nov 10, 2022
@sthalik sthalik deleted the pr/stringview-literal branch November 11, 2022 14:00
@mosra mosra mentioned this pull request Nov 14, 2022
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants