Skip to content

Commit

Permalink
duration: adjust for C++20 char8_t type
Browse files Browse the repository at this point in the history
C++20 makes string literals defined with u8"blah" return a new
char8_t type, which is sensible but noisy here.

Adjust for it by dropping an unneeded u8 in one place, and adding a
cast in another.
Message-Id: <[email protected]>
  • Loading branch information
avikivity authored and tgrabiec committed May 12, 2020
1 parent 89ea879 commit 07061f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions duration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ std::optional<cql_duration> parse_duration_standard_format(std::string_view s) {
//

static const auto pattern =
std::regex(u8"(\\d+)(y|Y|mo|MO|mO|Mo|w|W|d|D|h|H|s|S|ms|MS|mS|Ms|us|US|uS|Us|µs|µS|ns|NS|nS|Ns|m|M)");
std::regex("(\\d+)(y|Y|mo|MO|mO|Mo|w|W|d|D|h|H|s|S|ms|MS|mS|Ms|us|US|uS|Us|µs|µS|ns|NS|nS|Ns|m|M)");

auto iter = s.cbegin();
std::cmatch match;
Expand All @@ -291,7 +291,7 @@ std::optional<cql_duration> parse_duration_standard_format(std::string_view s) {
auto view = std::string_view(symbol);
view.remove_suffix(1);

if (view == u8"µ") {
if (view == reinterpret_cast<const char*>(u8"µ")) {
b.add_parsed_count(match, 1, microsecond);
continue;
}
Expand Down

0 comments on commit 07061f9

Please sign in to comment.