From 7cbdff8c13503561a166438e45bc37c5c5d0066b Mon Sep 17 00:00:00 2001 From: Jorg Brown Date: Fri, 2 Dec 2022 07:27:34 -0800 Subject: Use a c++14-style constexpr initialization if c++14 constexpr is available. PiperOrigin-RevId: 492463896 Change-Id: I063759ca5ceb3597a7c8ab25af23aa688dee26c2 --- absl/strings/internal/char_map.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'absl/strings/internal/char_map.h') diff --git a/absl/strings/internal/char_map.h b/absl/strings/internal/char_map.h index 5aabc1fc..70a90343 100644 --- a/absl/strings/internal/char_map.h +++ b/absl/strings/internal/char_map.h @@ -73,10 +73,10 @@ class Charmap { } // 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) { - 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]. -- cgit v1.2.3