diff options
author | Copybara-Service <copybara-worker@google.com> | 2023-02-22 10:52:21 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-22 10:52:21 -0800 |
commit | 402e1319211cf19e455aa2a3b2de1f1235bb4326 (patch) | |
tree | 8718ce8da0130fb6d4e2f2d8809f5f78aa899061 /absl/types | |
parent | 277af61c83028863dfac4260ad24b3d579f3201b (diff) | |
parent | 6247f0e918bbc0519955d41b135069dcc2bbd453 (diff) | |
download | abseil-402e1319211cf19e455aa2a3b2de1f1235bb4326.tar.gz abseil-402e1319211cf19e455aa2a3b2de1f1235bb4326.tar.bz2 abseil-402e1319211cf19e455aa2a3b2de1f1235bb4326.zip |
Merge pull request #1403 from AtariDreams:c++11
PiperOrigin-RevId: 511539869
Change-Id: I32d5e91537b078691988e7e6d3244c682eb8d7d2
Diffstat (limited to 'absl/types')
-rw-r--r-- | absl/types/internal/span.h | 2 | ||||
-rw-r--r-- | absl/types/internal/variant.h | 4 | ||||
-rw-r--r-- | absl/types/optional_test.cc | 28 | ||||
-rw-r--r-- | absl/types/span_test.cc | 2 |
4 files changed, 10 insertions, 26 deletions
diff --git a/absl/types/internal/span.h b/absl/types/internal/span.h index 344ad4db..a196362a 100644 --- a/absl/types/internal/span.h +++ b/absl/types/internal/span.h @@ -88,7 +88,7 @@ using EnableIfMutable = template <template <typename> class SpanT, typename T> bool EqualImpl(SpanT<T> a, SpanT<T> b) { static_assert(std::is_const<T>::value, ""); - return absl::equal(a.begin(), a.end(), b.begin(), b.end()); + return std::equal(a.begin(), a.end(), b.begin(), b.end()); } template <template <typename> class SpanT, typename T> diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h index c82ded44..fc8829e5 100644 --- a/absl/types/internal/variant.h +++ b/absl/types/internal/variant.h @@ -877,8 +877,8 @@ struct IndexOfConstructedType< template <std::size_t... Is> struct ContainsVariantNPos : absl::negation<std::is_same< // NOLINT - absl::integer_sequence<bool, 0 <= Is...>, - absl::integer_sequence<bool, Is != absl::variant_npos...>>> {}; + std::integer_sequence<bool, 0 <= Is...>, + std::integer_sequence<bool, Is != absl::variant_npos...>>> {}; template <class Op, class... QualifiedVariants> using RawVisitResult = diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc index 21653a90..83a9bb4a 100644 --- a/absl/types/optional_test.cc +++ b/absl/types/optional_test.cc @@ -97,9 +97,9 @@ struct StructorListener { // 4522: multiple assignment operators specified // We wrote multiple of them to test that the correct overloads are selected. #ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4521) -#pragma warning( disable : 4522) +#pragma warning(push) +#pragma warning(disable : 4521) +#pragma warning(disable : 4522) #endif struct Listenable { static StructorListener* listener; @@ -133,20 +133,11 @@ struct Listenable { ~Listenable() { ++listener->destruct; } }; #ifdef _MSC_VER -#pragma warning( pop ) +#pragma warning(pop) #endif StructorListener* Listenable::listener = nullptr; -// ABSL_HAVE_NO_CONSTEXPR_INITIALIZER_LIST is defined to 1 when the standard -// library implementation doesn't marked initializer_list's default constructor -// constexpr. The C++11 standard doesn't specify constexpr on it, but C++14 -// added it. However, libstdc++ 4.7 marked it constexpr. -#if defined(_LIBCPP_VERSION) && \ - (_LIBCPP_STD_VER <= 11 || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)) -#define ABSL_HAVE_NO_CONSTEXPR_INITIALIZER_LIST 1 -#endif - struct ConstexprType { enum CtorTypes { kCtorDefault, @@ -156,10 +147,8 @@ struct ConstexprType { }; constexpr ConstexprType() : x(kCtorDefault) {} constexpr explicit ConstexprType(int i) : x(kCtorInt) {} -#ifndef ABSL_HAVE_NO_CONSTEXPR_INITIALIZER_LIST constexpr ConstexprType(std::initializer_list<int> il) : x(kCtorInitializerList) {} -#endif constexpr ConstexprType(const char*) // NOLINT(runtime/explicit) : x(kCtorConstChar) {} int x; @@ -352,11 +341,9 @@ TEST(optionalTest, InPlaceConstructor) { constexpr absl::optional<ConstexprType> opt1{absl::in_place_t(), 1}; static_assert(opt1, ""); static_assert((*opt1).x == ConstexprType::kCtorInt, ""); -#ifndef ABSL_HAVE_NO_CONSTEXPR_INITIALIZER_LIST constexpr absl::optional<ConstexprType> opt2{absl::in_place_t(), {1, 2}}; static_assert(opt2, ""); static_assert((*opt2).x == ConstexprType::kCtorInitializerList, ""); -#endif EXPECT_FALSE((std::is_constructible<absl::optional<ConvertsFromInPlaceT>, absl::in_place_t>::value)); @@ -1000,9 +987,8 @@ TEST(optionalTest, PointerStuff) { // Skip that test to make the build green again when using the old compiler. // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59296 is fixed in 4.9.1. #if defined(__GNUC__) && !defined(__clang__) -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) +#define GCC_VERSION \ + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #if GCC_VERSION < 40901 #define ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG #endif @@ -1214,7 +1200,6 @@ void optionalTest_Comparisons_EXPECT_GREATER(T x, U y) { EXPECT_TRUE(x >= y); } - template <typename T, typename U, typename V> void TestComparisons() { absl::optional<T> ae, a2{2}, a4{4}; @@ -1307,7 +1292,6 @@ TEST(optionalTest, Comparisons) { EXPECT_TRUE(e1 == e2); } - TEST(optionalTest, SwapRegression) { StructorListener listener; Listenable::listener = &listener; diff --git a/absl/types/span_test.cc b/absl/types/span_test.cc index 13264aae..29e8681f 100644 --- a/absl/types/span_test.cc +++ b/absl/types/span_test.cc @@ -191,7 +191,7 @@ TEST(IntSpan, SpanOfDerived) { } void TestInitializerList(absl::Span<const int> s, const std::vector<int>& v) { - EXPECT_TRUE(absl::equal(s.begin(), s.end(), v.begin(), v.end())); + EXPECT_TRUE(std::equal(s.begin(), s.end(), v.begin(), v.end())); } TEST(ConstIntSpan, InitializerListConversion) { |