diff options
Diffstat (limited to 'absl/strings/internal/string_constant.h')
-rw-r--r-- | absl/strings/internal/string_constant.h | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/absl/strings/internal/string_constant.h b/absl/strings/internal/string_constant.h index b15f1d9b..a11336b7 100644 --- a/absl/strings/internal/string_constant.h +++ b/absl/strings/internal/string_constant.h @@ -35,18 +35,12 @@ namespace strings_internal { // below. template <typename T> struct StringConstant { - private: - // Returns true if `view` points to constant data. - // Otherwise, it can't be constant evaluated. - static constexpr bool ValidateConstant(absl::string_view view) { - return view.empty() || 2 * view[0] != 1; - } - - public: static constexpr absl::string_view value = T{}(); constexpr absl::string_view operator()() const { return value; } - static_assert(ValidateConstant(value), + // Check to be sure `view` points to constant data. + // Otherwise, it can't be constant evaluated. + static_assert(value.empty() || 2 * value[0] != 1, "The input string_view must point to constant data."); }; |