Commit 7cbdff8c by Jorg Brown Committed by Copybara-Service

Use a c++14-style constexpr initialization if c++14 constexpr is available.

PiperOrigin-RevId: 492463896
Change-Id: I063759ca5ceb3597a7c8ab25af23aa688dee26c2
parent 1063d2b8
...@@ -73,10 +73,10 @@ class Charmap { ...@@ -73,10 +73,10 @@ class Charmap {
} }
// Containing all the chars in the C-string 's'. // Containing all the chars in the C-string 's'.
// Note that this is expensively recursive because of the C++11 constexpr
// formulation. Use only in constexpr initializers.
static constexpr Charmap FromString(const char* s) { static constexpr Charmap FromString(const char* s) {
return *s == 0 ? Charmap() : (Char(*s) | FromString(s + 1)); Charmap ret;
while (*s) ret = ret | Char(*s++);
return ret;
} }
// Containing all the chars in the closed interval [lo,hi]. // Containing all the chars in the closed interval [lo,hi].
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment