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

Add user-defined literal support for string_constant #33

Open
cmazakas opened this issue Sep 6, 2024 · 0 comments
Open

Add user-defined literal support for string_constant #33

cmazakas opened this issue Sep 6, 2024 · 0 comments

Comments

@cmazakas
Copy link
Collaborator

cmazakas commented Sep 6, 2024

We need a way of supporting a syntax like:

std2::string_constant<char> str = "hello, world!"sc;

Currently, this doesn't seem possible as there's no constructor for string_constant from a char pointer, such as here:

#feature on safety
#include <std2.h>

using namespace std2;

inline auto operator""sv2(std2::string_constant<char> sc) noexcept safe -> string_view/static {
  return string_view(sc);
}

int main() {
  string_view sv = "Hello"sv2;
}
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

No branches or pull requests

1 participant