This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3 PATCH] Implement P0403R1, Literal suffixes for basic_string_view.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]