This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 PATCH] Implement P0403R1, Literal suffixes for basic_string_view.
- From: François Dumont <frs dot dumont at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 14 Nov 2016 21:23:45 +0100
- Subject: Re: [v3 PATCH] Implement P0403R1, Literal suffixes for basic_string_view.
- Authentication-results: sourceware.org; auth=none
- References: <CAFk2RUbrw+_SNtFjrE+yKQ1951OrGW4dLO9LezcAFhc+dwoX4Q@mail.gmail.com>
On 13/11/2016 21:41, Ville Voutilainen wrote:
Tested on Linux-x64.
2016-11-13 Ville Voutilainen<ville.voutilainen@gmail.com>
Implement P0403R1, Literal suffixes for basic_string_view.
* include/std/string_view
(operator""sv(const char*, size_t)): New.
(operator""sv(const wchar_t*, size_t)): Likewise.
(operator""sv(const char16_t*, size_t)): Likewise.
(operator""sv(const char32_t*, size_t)): Likewise.
* testsuite/21_strings/basic_string_view/literals/types.cc: New.
* testsuite/21_strings/basic_string_view/literals/values.cc: Likewise.
* testsuite/experimental/string_view/literals/values.cc: Add
tests for literals with embedded NULs.
Just a minor issue in several assert messages:
+ static_assert(std::is_same<decltype("Hello"sv), std::string_view>::value,
+ "\"Hello\"s is std::string_view");
should say "\"Hello\"sv is...
I considered using string_view in my recent print_word evolution in debug.cc. With this patch it would be a nicer way to deal with literals.
François