Commit 504229df by Derek Mauro Committed by Copybara-Service

string_view: conditional constexpr is no longer needed for C++14

PiperOrigin-RevId: 460407142
Change-Id: I9501d2e79cf8c20c5261ab0169bd4bbc3b02980c
parent 427d8f57
...@@ -63,12 +63,6 @@ ABSL_NAMESPACE_END ...@@ -63,12 +63,6 @@ ABSL_NAMESPACE_END
#define ABSL_INTERNAL_STRING_VIEW_MEMCMP memcmp #define ABSL_INTERNAL_STRING_VIEW_MEMCMP memcmp
#endif // ABSL_HAVE_BUILTIN(__builtin_memcmp) #endif // ABSL_HAVE_BUILTIN(__builtin_memcmp)
#if defined(__cplusplus) && __cplusplus >= 201402L
#define ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR constexpr
#else
#define ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR
#endif
namespace absl { namespace absl {
ABSL_NAMESPACE_BEGIN ABSL_NAMESPACE_BEGIN
...@@ -341,7 +335,7 @@ class string_view { ...@@ -341,7 +335,7 @@ class string_view {
// //
// Removes the first `n` characters from the `string_view`. Note that the // Removes the first `n` characters from the `string_view`. Note that the
// underlying string is not changed, only the view. // underlying string is not changed, only the view.
ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR void remove_prefix(size_type n) { constexpr void remove_prefix(size_type n) {
ABSL_HARDENING_ASSERT(n <= length_); ABSL_HARDENING_ASSERT(n <= length_);
ptr_ += n; ptr_ += n;
length_ -= n; length_ -= n;
...@@ -351,7 +345,7 @@ class string_view { ...@@ -351,7 +345,7 @@ class string_view {
// //
// Removes the last `n` characters from the `string_view`. Note that the // Removes the last `n` characters from the `string_view`. Note that the
// underlying string is not changed, only the view. // underlying string is not changed, only the view.
ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR void remove_suffix(size_type n) { constexpr void remove_suffix(size_type n) {
ABSL_HARDENING_ASSERT(n <= length_); ABSL_HARDENING_ASSERT(n <= length_);
length_ -= n; length_ -= n;
} }
...@@ -359,7 +353,7 @@ class string_view { ...@@ -359,7 +353,7 @@ class string_view {
// string_view::swap() // string_view::swap()
// //
// Swaps this `string_view` with another `string_view`. // Swaps this `string_view` with another `string_view`.
ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR void swap(string_view& s) noexcept { constexpr void swap(string_view& s) noexcept {
auto t = *this; auto t = *this;
*this = s; *this = s;
s = t; s = t;
...@@ -678,7 +672,6 @@ std::ostream& operator<<(std::ostream& o, string_view piece); ...@@ -678,7 +672,6 @@ std::ostream& operator<<(std::ostream& o, string_view piece);
ABSL_NAMESPACE_END ABSL_NAMESPACE_END
} // namespace absl } // namespace absl
#undef ABSL_INTERNAL_STRING_VIEW_CXX14_CONSTEXPR
#undef ABSL_INTERNAL_STRING_VIEW_MEMCMP #undef ABSL_INTERNAL_STRING_VIEW_MEMCMP
#endif // ABSL_USES_STD_STRING_VIEW #endif // ABSL_USES_STD_STRING_VIEW
......
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