diff --git a/CMake/AbseilDll.cmake b/CMake/AbseilDll.cmake index f7d6b56..6371298 100644 --- a/CMake/AbseilDll.cmake +++ b/CMake/AbseilDll.cmake
@@ -153,9 +153,11 @@ "debugging/symbolize.cc" "debugging/symbolize.h" "functional/any_invocable.h" + "functional/bind_back.h" "functional/bind_front.h" "functional/function_ref.h" "functional/internal/any_invocable.h" + "functional/internal/back_binder.h" "functional/internal/front_binder.h" "functional/internal/function_ref.h" "functional/overload.h"
diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h index 3636f8e..a823ee1 100644 --- a/absl/algorithm/container.h +++ b/absl/algorithm/container.h
@@ -819,8 +819,8 @@ typename Iterator = container_algorithm_internal::ContainerIter<C>> ABSL_INTERNAL_CONSTEXPR_SINCE_CXX20 Iterator c_rotate(C& sequence, Iterator middle) { - return absl::rotate(container_algorithm_internal::c_begin(sequence), middle, - container_algorithm_internal::c_end(sequence)); + return std::rotate(container_algorithm_internal::c_begin(sequence), middle, + container_algorithm_internal::c_end(sequence)); } // c_rotate_copy()
diff --git a/absl/algorithm/container_test.cc b/absl/algorithm/container_test.cc index 347b41f..8a898be 100644 --- a/absl/algorithm/container_test.cc +++ b/absl/algorithm/container_test.cc
@@ -729,11 +729,11 @@ TEST(MutatingTest, Move) { std::vector<std::unique_ptr<int>> src; - src.emplace_back(absl::make_unique<int>(1)); - src.emplace_back(absl::make_unique<int>(2)); - src.emplace_back(absl::make_unique<int>(3)); - src.emplace_back(absl::make_unique<int>(4)); - src.emplace_back(absl::make_unique<int>(5)); + src.emplace_back(std::make_unique<int>(1)); + src.emplace_back(std::make_unique<int>(2)); + src.emplace_back(std::make_unique<int>(3)); + src.emplace_back(std::make_unique<int>(4)); + src.emplace_back(std::make_unique<int>(5)); std::vector<std::unique_ptr<int>> dest = {}; absl::c_move(src, std::back_inserter(dest)); @@ -744,11 +744,11 @@ TEST(MutatingTest, MoveBackward) { std::vector<std::unique_ptr<int>> actual; - actual.emplace_back(absl::make_unique<int>(1)); - actual.emplace_back(absl::make_unique<int>(2)); - actual.emplace_back(absl::make_unique<int>(3)); - actual.emplace_back(absl::make_unique<int>(4)); - actual.emplace_back(absl::make_unique<int>(5)); + actual.emplace_back(std::make_unique<int>(1)); + actual.emplace_back(std::make_unique<int>(2)); + actual.emplace_back(std::make_unique<int>(3)); + actual.emplace_back(std::make_unique<int>(4)); + actual.emplace_back(std::make_unique<int>(5)); auto subrange = absl::MakeSpan(actual.data(), 3); absl::c_move_backward(subrange, actual.end()); EXPECT_THAT(actual, ElementsAre(IsNull(), IsNull(), Pointee(1), Pointee(2), @@ -758,9 +758,9 @@ TEST(MutatingTest, MoveWithRvalue) { auto MakeRValueSrc = [] { std::vector<std::unique_ptr<int>> src; - src.emplace_back(absl::make_unique<int>(1)); - src.emplace_back(absl::make_unique<int>(2)); - src.emplace_back(absl::make_unique<int>(3)); + src.emplace_back(std::make_unique<int>(1)); + src.emplace_back(std::make_unique<int>(2)); + src.emplace_back(std::make_unique<int>(3)); return src; };
diff --git a/absl/base/attributes.h b/absl/base/attributes.h index 327b222..5887fca 100644 --- a/absl/base/attributes.h +++ b/absl/base/attributes.h
@@ -541,7 +541,8 @@ // The clang-tidy check bugprone-use-after-move allows member functions of types // marked with this attribute to be called on objects that have been moved from; // without the attribute, this would result in a use-after-move warning. -#if ABSL_HAVE_CPP_ATTRIBUTE(clang::annotate) +#if ABSL_HAVE_CPP_ATTRIBUTE(clang::annotate) && defined(__clang__) && \ + __clang_major__ >= 12 #define ABSL_ATTRIBUTE_NULL_AFTER_MOVE \ [[clang::annotate("clang-tidy", "bugprone-use-after-move", \ "null_after_move")]]
diff --git a/absl/base/config.h b/absl/base/config.h index b707654..d4a7bfb 100644 --- a/absl/base/config.h +++ b/absl/base/config.h
@@ -882,16 +882,16 @@ #endif #ifdef __EMSCRIPTEN__ #include <emscripten/version.h> -#ifdef __EMSCRIPTEN_major__ -#if __EMSCRIPTEN_minor__ >= 1000 -#error __EMSCRIPTEN_minor__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION +#ifdef __EMSCRIPTEN_MAJOR__ +#if __EMSCRIPTEN_MINOR__ >= 1000 +#error __EMSCRIPTEN_MINOR__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION #endif -#if __EMSCRIPTEN_tiny__ >= 1000 -#error __EMSCRIPTEN_tiny__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION +#if __EMSCRIPTEN_TINY__ >= 1000 +#error __EMSCRIPTEN_TINY__ is too big to fit in ABSL_INTERNAL_EMSCRIPTEN_VERSION #endif #define ABSL_INTERNAL_EMSCRIPTEN_VERSION \ - ((__EMSCRIPTEN_major__) * 1000000 + (__EMSCRIPTEN_minor__) * 1000 + \ - (__EMSCRIPTEN_tiny__)) + ((__EMSCRIPTEN_MAJOR__) * 1000000 + (__EMSCRIPTEN_MINOR__) * 1000 + \ + (__EMSCRIPTEN_TINY__)) #endif #endif
diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc index a0b6f9a..d615a38 100644 --- a/absl/base/exception_safety_testing_test.cc +++ b/absl/base/exception_safety_testing_test.cc
@@ -236,8 +236,8 @@ TEST(ThrowingValueTest, ThrowingAllocatingOps) { // make_unique calls unqualified operator new, so these exercise the // ThrowingValue overloads. - TestAllocatingOp([]() { return absl::make_unique<ThrowingValue<>>(1); }); - TestAllocatingOp([]() { return absl::make_unique<ThrowingValue<>[]>(2); }); + TestAllocatingOp([]() { return std::make_unique<ThrowingValue<>>(1); }); + TestAllocatingOp([]() { return std::make_unique<ThrowingValue<>[]>(2); }); } TEST(ThrowingValueTest, NonThrowingMoveCtor) { @@ -546,7 +546,7 @@ using T = exceptions_internal::UninitializedT; auto op = [](T* t) {}; auto inv = [](T*) { return testing::AssertionSuccess(); }; - auto fac = []() { return absl::make_unique<T>(); }; + auto fac = []() { return std::make_unique<T>(); }; // Test that providing operation and inveriants still does not allow for the // the invocation of .Test() and .Test(op) because it lacks a factory @@ -575,7 +575,7 @@ struct ExampleStruct {}; std::unique_ptr<ExampleStruct> ExampleFunctionFactory() { - return absl::make_unique<ExampleStruct>(); + return std::make_unique<ExampleStruct>(); } void ExampleFunctionOperation(ExampleStruct*) {} @@ -792,7 +792,7 @@ }; TEST(ExceptionCheckTest, NonCopyable) { - auto factory = []() { return absl::make_unique<NonCopyable>(); }; + auto factory = []() { return std::make_unique<NonCopyable>(); }; EXPECT_TRUE(tester.WithFactory(factory).Test()); EXPECT_TRUE(strong_tester.WithFactory(factory).Test()); }
diff --git a/absl/base/internal/exception_safety_testing.h b/absl/base/internal/exception_safety_testing.h index 29f934f..a2d128e 100644 --- a/absl/base/internal/exception_safety_testing.h +++ b/absl/base/internal/exception_safety_testing.h
@@ -837,7 +837,7 @@ class DefaultFactory { public: explicit DefaultFactory(const T& t) : t_(t) {} - std::unique_ptr<T> operator()() const { return absl::make_unique<T>(t_); } + std::unique_ptr<T> operator()() const { return std::make_unique<T>(t_); } private: T t_; @@ -1056,7 +1056,7 @@ typename NewOperation, typename = EnableIfTestable<sizeof...(Contracts), Factory, NewOperation>> testing::AssertionResult Test(const NewOperation& new_operation) const { - return TestImpl(new_operation, absl::index_sequence_for<Contracts...>()); + return TestImpl(new_operation, std::index_sequence_for<Contracts...>()); } /* @@ -1092,7 +1092,7 @@ template <typename SelectedOperation, size_t... Indices> testing::AssertionResult TestImpl(SelectedOperation selected_operation, - absl::index_sequence<Indices...>) const { + std::index_sequence<Indices...>) const { return ExceptionSafetyTest<FactoryElementType<Factory>>( factory_, selected_operation, std::get<Indices>(contracts_)...) .Test();
diff --git a/absl/base/internal/unscaledcycleclock.h b/absl/base/internal/unscaledcycleclock.h index 94c4bea..fb5751b 100644 --- a/absl/base/internal/unscaledcycleclock.h +++ b/absl/base/internal/unscaledcycleclock.h
@@ -79,6 +79,7 @@ friend class base_internal::CycleClock; friend class time_internal::UnscaledCycleClockWrapperForGetCurrentTime; friend class base_internal::UnscaledCycleClockWrapperForInitializeFrequency; + friend class gloop_do_not_use::UnscaledCycleClockWrapperForPerCpuTest; }; #if defined(__x86_64__)
diff --git a/absl/base/nullability.h b/absl/base/nullability.h index 53aa54f..ad80178 100644 --- a/absl/base/nullability.h +++ b/absl/base/nullability.h
@@ -95,7 +95,7 @@ // // describes is preferred, unless inconsistent with surrounding code. // absl_nonnull std::unique_ptr<Employee> employee; // -// // Invalid annotation usage – this attempts to declare a pointer to a +// // Invalid annotation usage - this attempts to declare a pointer to a // // nullable `Employee`, which is meaningless. // absl_nullable Employee* e; // @@ -130,7 +130,7 @@ // // // CompleteTransaction() guarantees the returned pointer to an `Account` to // // be non-null. -// Account* absl_nonnull balance CompleteTransaction(double fee) { +// Account* absl_nonnull CompleteTransaction(double fee) { // ... // } // @@ -204,7 +204,7 @@ // T* absl_nullable GetNullablePtr(); // explicitly nullable // T* absl_nullability_unknown GetUnknownPtr(); // explicitly unknown // -// The macro can be safely used in header files – it will not affect any files +// The macro can be safely used in header files - it will not affect any files // that include it. // // In files with the macro, plain `T*` syntax means `T* absl_nonnull`, and the
diff --git a/absl/container/btree_benchmark.cc b/absl/container/btree_benchmark.cc index ee4efbd..69a8195 100644 --- a/absl/container/btree_benchmark.cc +++ b/absl/container/btree_benchmark.cc
@@ -668,15 +668,13 @@ template <int Size> struct BigTypePtr { BigTypePtr() : BigTypePtr(0) {} - explicit BigTypePtr(int x) { - ptr = absl::make_unique<BigType<Size, Size>>(x); - } + explicit BigTypePtr(int x) { ptr = std::make_unique<BigType<Size, Size>>(x); } BigTypePtr(const BigTypePtr& other) { - ptr = absl::make_unique<BigType<Size, Size>>(*other.ptr); + ptr = std::make_unique<BigType<Size, Size>>(*other.ptr); } BigTypePtr(BigTypePtr&& other) noexcept = default; BigTypePtr& operator=(const BigTypePtr& other) { - ptr = absl::make_unique<BigType<Size, Size>>(*other.ptr); + ptr = std::make_unique<BigType<Size, Size>>(*other.ptr); } BigTypePtr& operator=(BigTypePtr&& other) noexcept = default;
diff --git a/absl/container/btree_set.h b/absl/container/btree_set.h index 991cb89..2dbcc2c 100644 --- a/absl/container/btree_set.h +++ b/absl/container/btree_set.h
@@ -805,23 +805,23 @@ template <typename Alloc, class... Args> static void construct(Alloc *alloc, slot_type *slot, Args &&...args) { - absl::allocator_traits<Alloc>::construct(*alloc, slot, - std::forward<Args>(args)...); + std::allocator_traits<Alloc>::construct(*alloc, slot, + std::forward<Args>(args)...); } template <typename Alloc> static void construct(Alloc *alloc, slot_type *slot, slot_type *other) { - absl::allocator_traits<Alloc>::construct(*alloc, slot, std::move(*other)); + std::allocator_traits<Alloc>::construct(*alloc, slot, std::move(*other)); } template <typename Alloc> static void construct(Alloc *alloc, slot_type *slot, const slot_type *other) { - absl::allocator_traits<Alloc>::construct(*alloc, slot, *other); + std::allocator_traits<Alloc>::construct(*alloc, slot, *other); } template <typename Alloc> static void destroy(Alloc *alloc, slot_type *slot) { - absl::allocator_traits<Alloc>::destroy(*alloc, slot); + std::allocator_traits<Alloc>::destroy(*alloc, slot); } };
diff --git a/absl/container/btree_test.cc b/absl/container/btree_test.cc index dc880a8..f3dca8a 100644 --- a/absl/container/btree_test.cc +++ b/absl/container/btree_test.cc
@@ -1174,7 +1174,7 @@ std::unique_ptr<std::string> &v = m["A"]; EXPECT_TRUE(v == nullptr); - v = absl::make_unique<std::string>("X"); + v = std::make_unique<std::string>("X"); auto iter = m.find("A"); EXPECT_EQ("X", *iter->second);
diff --git a/absl/container/fixed_array_test.cc b/absl/container/fixed_array_test.cc index 6175a7c..54e5fd6 100644 --- a/absl/container/fixed_array_test.cc +++ b/absl/container/fixed_array_test.cc
@@ -112,7 +112,7 @@ TEST(FixedArrayTest, MoveCtor) { absl::FixedArray<std::unique_ptr<int>, 10> on_stack(5); for (int i = 0; i < 5; ++i) { - on_stack[i] = absl::make_unique<int>(i); + on_stack[i] = std::make_unique<int>(i); } absl::FixedArray<std::unique_ptr<int>, 10> stack_copy = std::move(on_stack); @@ -121,7 +121,7 @@ absl::FixedArray<std::unique_ptr<int>, 10> allocated(15); for (int i = 0; i < 15; ++i) { - allocated[i] = absl::make_unique<int>(i); + allocated[i] = std::make_unique<int>(i); } absl::FixedArray<std::unique_ptr<int>, 10> alloced_copy = @@ -307,7 +307,7 @@ using InnerArray = ConstructionTester[elements_per_inner_array]; // Heap-allocate the FixedArray to avoid blowing the stack frame. auto array_ptr = - absl::make_unique<absl::FixedArray<InnerArray, inline_elements>>(n); + std::make_unique<absl::FixedArray<InnerArray, inline_elements>>(n); auto& array = *array_ptr; ASSERT_EQ(array.size(), n);
diff --git a/absl/container/flat_hash_set.h b/absl/container/flat_hash_set.h index 44af56a..6d37219 100644 --- a/absl/container/flat_hash_set.h +++ b/absl/container/flat_hash_set.h
@@ -552,14 +552,14 @@ template <class Allocator, class... Args> static void construct(Allocator* alloc, slot_type* slot, Args&&... args) { - absl::allocator_traits<Allocator>::construct(*alloc, slot, - std::forward<Args>(args)...); + std::allocator_traits<Allocator>::construct(*alloc, slot, + std::forward<Args>(args)...); } // Return std::true_type in case destroy is trivial. template <class Allocator> static auto destroy(Allocator* alloc, slot_type* slot) { - absl::allocator_traits<Allocator>::destroy(*alloc, slot); + std::allocator_traits<Allocator>::destroy(*alloc, slot); return IsDestructionTrivial<Allocator, slot_type>(); }
diff --git a/absl/container/flat_hash_set_test.cc b/absl/container/flat_hash_set_test.cc index f776f38..95ead48 100644 --- a/absl/container/flat_hash_set_test.cc +++ b/absl/container/flat_hash_set_test.cc
@@ -109,11 +109,11 @@ } }; absl::flat_hash_set<std::unique_ptr<int>, Hash, Eq> set1, set2; - set1.insert(absl::make_unique<int>(7)); - set1.insert(absl::make_unique<int>(17)); + set1.insert(std::make_unique<int>(7)); + set1.insert(std::make_unique<int>(17)); - set2.insert(absl::make_unique<int>(7)); - set2.insert(absl::make_unique<int>(19)); + set2.insert(std::make_unique<int>(7)); + set2.insert(std::make_unique<int>(19)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7), Pointee(19))); @@ -123,7 +123,7 @@ EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17), Pointee(19))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - auto node = set1.extract(absl::make_unique<int>(7)); + auto node = set1.extract(std::make_unique<int>(7)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(7)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(17), Pointee(19))); @@ -137,12 +137,12 @@ EXPECT_NE(insert_result.position->get(), insert_result.node.value().get()); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - node = set1.extract(absl::make_unique<int>(17)); + node = set1.extract(std::make_unique<int>(17)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(17)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(19))); - node.value() = absl::make_unique<int>(23); + node.value() = std::make_unique<int>(23); insert_result = set2.insert(std::move(node)); EXPECT_FALSE(node);
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc index 1e3ff82..ba96be3 100644 --- a/absl/container/inlined_vector_test.cc +++ b/absl/container/inlined_vector_test.cc
@@ -823,7 +823,7 @@ : p_(new int(*other.p_)) {} NotTriviallyDestructible& operator=(const NotTriviallyDestructible& other) { - p_ = absl::make_unique<int>(*other.p_); + p_ = std::make_unique<int>(*other.p_); return *this; } @@ -1995,7 +1995,7 @@ TEST(InlinedVectorTest, MinimumAllocatorCompilesUsingTraits) { using T = int; using A = std::allocator<T>; - using ATraits = absl::allocator_traits<A>; + using ATraits = std::allocator_traits<A>; struct MinimumAllocator { using value_type = T;
diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index 3815382..85e13c9 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h
@@ -53,6 +53,7 @@ #include <functional> #include <iterator> #include <limits> +#include <memory> #include <string> #include <type_traits> #include <utility> @@ -2489,7 +2490,7 @@ clear(); *mutable_key_comp() = other.key_comp(); - if (absl::allocator_traits< + if (std::allocator_traits< allocator_type>::propagate_on_container_copy_assignment::value) { *mutable_allocator() = other.allocator(); } @@ -2505,7 +2506,7 @@ clear(); using std::swap; - if (absl::allocator_traits< + if (std::allocator_traits< allocator_type>::propagate_on_container_move_assignment::value) { swap(root_, other.root_); // Note: `rightmost_` also contains the allocator and the key comparator. @@ -2681,7 +2682,7 @@ template <typename P> void btree<P>::swap(btree &other) { using std::swap; - if (absl::allocator_traits< + if (std::allocator_traits< allocator_type>::propagate_on_container_swap::value) { // Note: `rightmost_` also contains the allocator and the key comparator. swap(rightmost_, other.rightmost_);
diff --git a/absl/container/internal/btree_container.h b/absl/container/internal/btree_container.h index 39371a9..d4ce523 100644 --- a/absl/container/internal/btree_container.h +++ b/absl/container/internal/btree_container.h
@@ -18,6 +18,7 @@ #include <algorithm> #include <initializer_list> #include <iterator> +#include <memory> #include <type_traits> #include <utility> @@ -80,8 +81,8 @@ explicit btree_container(const allocator_type &alloc) : tree_(key_compare(), alloc) {} - btree_container(const btree_container &other) - : btree_container(other, absl::allocator_traits<allocator_type>:: + btree_container(const btree_container& other) + : btree_container(other, std::allocator_traits<allocator_type>:: select_on_container_copy_construction( other.get_allocator())) {} btree_container(const btree_container &other, const allocator_type &alloc)
diff --git a/absl/container/internal/compressed_tuple.h b/absl/container/internal/compressed_tuple.h index 9d5c055..924172f 100644 --- a/absl/container/internal/compressed_tuple.h +++ b/absl/container/internal/compressed_tuple.h
@@ -86,7 +86,7 @@ T value; constexpr Storage() = default; template <typename V> - explicit constexpr Storage(absl::in_place_t, V&& v) + explicit constexpr Storage(std::in_place_t, V&& v) : value(std::forward<V>(v)) {} constexpr const T& get() const& { return value; } constexpr T& get() & { return value; } @@ -99,7 +99,7 @@ constexpr Storage() = default; template <typename V> - explicit constexpr Storage(absl::in_place_t, V&& v) : T(std::forward<V>(v)) {} + explicit constexpr Storage(std::in_place_t, V&& v) : T(std::forward<V>(v)) {} constexpr const T& get() const& { return *this; } constexpr T& get() & { return *this; } @@ -112,7 +112,7 @@ template <typename... Ts, size_t... I, bool ShouldAnyUseBase> struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC - CompressedTupleImpl<CompressedTuple<Ts...>, absl::index_sequence<I...>, + CompressedTupleImpl<CompressedTuple<Ts...>, std::index_sequence<I...>, ShouldAnyUseBase> // We use the dummy identity function through std::integral_constant to // convince MSVC of accepting and expanding I in that context. Without it @@ -122,23 +122,23 @@ StorageTag<Ts...>>... { constexpr CompressedTupleImpl() = default; template <typename... Vs> - explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) - : Storage<Ts, I, StorageTag<Ts...>>(absl::in_place, + explicit constexpr CompressedTupleImpl(std::in_place_t, Vs&&... args) + : Storage<Ts, I, StorageTag<Ts...>>(std::in_place, std::forward<Vs>(args))... {} friend CompressedTuple<Ts...>; }; template <typename... Ts, size_t... I> struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC - CompressedTupleImpl<CompressedTuple<Ts...>, absl::index_sequence<I...>, + CompressedTupleImpl<CompressedTuple<Ts...>, std::index_sequence<I...>, false> // We use the dummy identity function as above... : Storage<Ts, std::integral_constant<size_t, I>::value, StorageTag<Ts...>, false>... { constexpr CompressedTupleImpl() = default; template <typename... Vs> - explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) - : Storage<Ts, I, StorageTag<Ts...>, false>(absl::in_place, + explicit constexpr CompressedTupleImpl(std::in_place_t, Vs&&... args) + : Storage<Ts, I, StorageTag<Ts...>, false>(std::in_place, std::forward<Vs>(args))... {} friend CompressedTuple<Ts...>; }; @@ -204,7 +204,7 @@ template <typename... Ts> class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple : private internal_compressed_tuple::CompressedTupleImpl< - CompressedTuple<Ts...>, absl::index_sequence_for<Ts...>, + CompressedTuple<Ts...>, std::index_sequence_for<Ts...>, internal_compressed_tuple::ShouldAnyUseBase<Ts...>()> { private: template <int I> @@ -224,19 +224,19 @@ constexpr CompressedTuple() = default; #endif explicit constexpr CompressedTuple(const Ts&... base) - : CompressedTuple::CompressedTupleImpl(absl::in_place, base...) {} + : CompressedTuple::CompressedTupleImpl(std::in_place, base...) {} template <typename First, typename... Vs, std::enable_if_t< std::conjunction< // Ensure we are not hiding default copy/move constructors. std::negation<std::is_same<void(CompressedTuple), - void(std::decay_t<First>)>>, + void(std::decay_t<First>)>>, internal_compressed_tuple::TupleItemsMoveConstructible< CompressedTuple<Ts...>, First, Vs...>>::value, bool> = true> explicit constexpr CompressedTuple(First&& first, Vs&&... base) - : CompressedTuple::CompressedTupleImpl(absl::in_place, + : CompressedTuple::CompressedTupleImpl(std::in_place, std::forward<First>(first), std::forward<Vs>(base)...) {}
diff --git a/absl/container/internal/compressed_tuple_test.cc b/absl/container/internal/compressed_tuple_test.cc index 47648c9..96b3917 100644 --- a/absl/container/internal/compressed_tuple_test.cc +++ b/absl/container/internal/compressed_tuple_test.cc
@@ -337,11 +337,11 @@ TEST(CompressedTupleTest, MoveOnlyElements) { CompressedTuple<std::unique_ptr<std::string>> str_tup( - absl::make_unique<std::string>("str")); + std::make_unique<std::string>("str")); CompressedTuple<CompressedTuple<std::unique_ptr<std::string>>, std::unique_ptr<int>> - x(std::move(str_tup), absl::make_unique<int>(5)); + x(std::move(str_tup), std::make_unique<int>(5)); EXPECT_EQ(*x.get<0>().get<0>(), "str"); EXPECT_EQ(*x.get<1>(), 5); @@ -355,7 +355,7 @@ TEST(CompressedTupleTest, MoveConstructionMoveOnlyElements) { CompressedTuple<std::unique_ptr<std::string>> base( - absl::make_unique<std::string>("str")); + std::make_unique<std::string>("str")); EXPECT_EQ(*base.get<0>(), "str"); CompressedTuple<std::unique_ptr<std::string>> copy(std::move(base));
diff --git a/absl/container/internal/container_memory.h b/absl/container/internal/container_memory.h index dcf0bd2..fc7633f 100644 --- a/absl/container/internal/container_memory.h +++ b/absl/container/internal/container_memory.h
@@ -63,8 +63,8 @@ static_assert(Alignment > 0, ""); assert(n && "n must be positive"); using M = AlignedType<Alignment>; - using A = typename absl::allocator_traits<Alloc>::template rebind_alloc<M>; - using AT = typename absl::allocator_traits<Alloc>::template rebind_traits<M>; + using A = typename std::allocator_traits<Alloc>::template rebind_alloc<M>; + using AT = typename std::allocator_traits<Alloc>::template rebind_traits<M>; // On macOS, "mem_alloc" is a #define with one argument defined in // rpc/types.h, so we can't name the variable "mem_alloc" and initialize it // with the "foo(bar)" syntax. @@ -81,7 +81,7 @@ constexpr auto IsDestructionTrivial() { constexpr bool result = std::is_trivially_destructible<ValueType>::value && - std::is_same<typename absl::allocator_traits< + std::is_same<typename std::allocator_traits< Allocator>::template rebind_alloc<char>, std::allocator<char>>::value; return std::integral_constant<bool, result>(); @@ -94,8 +94,8 @@ static_assert(Alignment > 0, ""); assert(n && "n must be positive"); using M = AlignedType<Alignment>; - using A = typename absl::allocator_traits<Alloc>::template rebind_alloc<M>; - using AT = typename absl::allocator_traits<Alloc>::template rebind_traits<M>; + using A = typename std::allocator_traits<Alloc>::template rebind_alloc<M>; + using AT = typename std::allocator_traits<Alloc>::template rebind_traits<M>; // On macOS, "mem_alloc" is a #define with one argument defined in // rpc/types.h, so we can't name the variable "mem_alloc" and initialize it // with the "foo(bar)" syntax. @@ -110,8 +110,8 @@ // specified in the tuple. template <class Alloc, class T, class Tuple, size_t... I> void ConstructFromTupleImpl(Alloc* alloc, T* ptr, Tuple&& t, - absl::index_sequence<I...>) { - absl::allocator_traits<Alloc>::construct( + std::index_sequence<I...>) { + std::allocator_traits<Alloc>::construct( *alloc, ptr, std::get<I>(std::forward<Tuple>(t))...); } @@ -127,13 +127,13 @@ template <class T, class Tuple, size_t... Is, class F> decltype(std::declval<F>()(std::declval<T>())) WithConstructedImpl( - Tuple&& t, absl::index_sequence<Is...>, F&& f) { + Tuple&& t, std::index_sequence<Is...>, F&& f) { return WithConstructedImplF<T, F>{std::forward<F>(f)}( std::get<Is>(std::forward<Tuple>(t))...); } template <class T, size_t... Is> -auto TupleRefImpl(T&& t, absl::index_sequence<Is...>) +auto TupleRefImpl(T&& t, std::index_sequence<Is...>) -> decltype(std::forward_as_tuple(std::get<Is>(std::forward<T>(t))...)) { // NOLINTNEXTLINE(bugprone-use-after-move) return std::forward_as_tuple(std::get<Is>(std::forward<T>(t))...); @@ -144,11 +144,11 @@ template <class T> auto TupleRef(T&& t) -> decltype(TupleRefImpl( std::forward<T>(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size<typename std::decay<T>::type>::value>())) { return TupleRefImpl( std::forward<T>(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size<typename std::decay<T>::type>::value>()); } @@ -169,7 +169,7 @@ void ConstructFromTuple(Alloc* alloc, T* ptr, Tuple&& t) { memory_internal::ConstructFromTupleImpl( alloc, ptr, std::forward<Tuple>(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size<typename std::decay<Tuple>::type>::value>()); } @@ -180,7 +180,7 @@ F&& f) { return memory_internal::WithConstructedImpl<T>( std::forward<Tuple>(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size<typename std::decay<Tuple>::type>::value>(), std::forward<F>(f)); } @@ -397,11 +397,11 @@ static void construct(Allocator* alloc, slot_type* slot, Args&&... args) { emplace(slot); if (kMutableKeys::value) { - absl::allocator_traits<Allocator>::construct(*alloc, &slot->mutable_value, - std::forward<Args>(args)...); + std::allocator_traits<Allocator>::construct(*alloc, &slot->mutable_value, + std::forward<Args>(args)...); } else { - absl::allocator_traits<Allocator>::construct(*alloc, &slot->value, - std::forward<Args>(args)...); + std::allocator_traits<Allocator>::construct(*alloc, &slot->value, + std::forward<Args>(args)...); } } @@ -410,11 +410,11 @@ static void construct(Allocator* alloc, slot_type* slot, slot_type* other) { emplace(slot); if (kMutableKeys::value) { - absl::allocator_traits<Allocator>::construct( + std::allocator_traits<Allocator>::construct( *alloc, &slot->mutable_value, std::move(other->mutable_value)); } else { - absl::allocator_traits<Allocator>::construct(*alloc, &slot->value, - std::move(other->value)); + std::allocator_traits<Allocator>::construct(*alloc, &slot->value, + std::move(other->value)); } } @@ -423,16 +423,16 @@ static void construct(Allocator* alloc, slot_type* slot, const slot_type* other) { emplace(slot); - absl::allocator_traits<Allocator>::construct(*alloc, &slot->value, - other->value); + std::allocator_traits<Allocator>::construct(*alloc, &slot->value, + other->value); } template <class Allocator> static auto destroy(Allocator* alloc, slot_type* slot) { if (kMutableKeys::value) { - absl::allocator_traits<Allocator>::destroy(*alloc, &slot->mutable_value); + std::allocator_traits<Allocator>::destroy(*alloc, &slot->mutable_value); } else { - absl::allocator_traits<Allocator>::destroy(*alloc, &slot->value); + std::allocator_traits<Allocator>::destroy(*alloc, &slot->value); } return IsDestructionTrivial<Allocator, value_type>(); } @@ -460,11 +460,11 @@ } if (kMutableKeys::value) { - absl::allocator_traits<Allocator>::construct( + std::allocator_traits<Allocator>::construct( *alloc, &new_slot->mutable_value, std::move(old_slot->mutable_value)); } else { - absl::allocator_traits<Allocator>::construct(*alloc, &new_slot->value, - std::move(old_slot->value)); + std::allocator_traits<Allocator>::construct(*alloc, &new_slot->value, + std::move(old_slot->value)); } destroy(alloc, old_slot); return is_relocatable;
diff --git a/absl/container/internal/hash_generator_testing.h b/absl/container/internal/hash_generator_testing.h index 4028413..1814678 100644 --- a/absl/container/internal/hash_generator_testing.h +++ b/absl/container/internal/hash_generator_testing.h
@@ -128,7 +128,7 @@ template <class T> struct Generator<std::unique_ptr<T>> { std::unique_ptr<T> operator()() const { - return absl::make_unique<T>(Generator<T>()()); + return std::make_unique<T>(Generator<T>()()); } };
diff --git a/absl/container/internal/layout.h b/absl/container/internal/layout.h index f49d272..442e208 100644 --- a/absl/container/internal/layout.h +++ b/absl/container/internal/layout.h
@@ -346,10 +346,10 @@ // can compute offsets). template <class... Elements, size_t... StaticSizeSeq, size_t... RuntimeSizeSeq, size_t... SizeSeq, size_t... OffsetSeq> -class LayoutImpl< - std::tuple<Elements...>, absl::index_sequence<StaticSizeSeq...>, - absl::index_sequence<RuntimeSizeSeq...>, absl::index_sequence<SizeSeq...>, - absl::index_sequence<OffsetSeq...>> { +class LayoutImpl<std::tuple<Elements...>, std::index_sequence<StaticSizeSeq...>, + std::index_sequence<RuntimeSizeSeq...>, + std::index_sequence<SizeSeq...>, + std::index_sequence<OffsetSeq...>> { private: static_assert(sizeof...(Elements) > 0, "At least one field is required"); static_assert(std::conjunction<IsLegalElementType<Elements>...>::value, @@ -687,10 +687,9 @@ template <class StaticSizeSeq, size_t NumRuntimeSizes, class... Ts> using LayoutType = LayoutImpl< - std::tuple<Ts...>, StaticSizeSeq, - absl::make_index_sequence<NumRuntimeSizes>, - absl::make_index_sequence<NumRuntimeSizes + StaticSizeSeq::size()>, - absl::make_index_sequence<adl_barrier::Min( + std::tuple<Ts...>, StaticSizeSeq, std::make_index_sequence<NumRuntimeSizes>, + std::make_index_sequence<NumRuntimeSizes + StaticSizeSeq::size()>, + std::make_index_sequence<adl_barrier::Min( sizeof...(Ts), NumRuntimeSizes + StaticSizeSeq::size() + 1)>>; template <class StaticSizeSeq, class... Ts> @@ -793,11 +792,12 @@ // internal_layout::LayoutImpl above. Those types are internal to the library // but their methods are public, and they are inherited by `Layout`. template <class... Ts> -class Layout : public internal_layout::LayoutWithStaticSizes< - absl::make_index_sequence<0>, Ts...> { +class Layout + : public internal_layout::LayoutWithStaticSizes<std::make_index_sequence<0>, + Ts...> { private: using Super = - internal_layout::LayoutWithStaticSizes<absl::make_index_sequence<0>, + internal_layout::LayoutWithStaticSizes<std::make_index_sequence<0>, Ts...>; public:
diff --git a/absl/container/internal/layout_test.cc b/absl/container/internal/layout_test.cc index 47fc9f3..e99c56a 100644 --- a/absl/container/internal/layout_test.cc +++ b/absl/container/internal/layout_test.cc
@@ -26,6 +26,7 @@ #include <string> #include <tuple> #include <type_traits> +#include <utility> #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -1436,7 +1437,7 @@ testing::MatchResultListener* /* listener */) const { static_assert(std::tuple_size<Tuple>::value == sizeof...(M), ""); return MatchAndExplainImpl( - p, absl::make_index_sequence<std::tuple_size<Tuple>::value>{}); + p, std::make_index_sequence<std::tuple_size<Tuple>::value>{}); } // For the matcher concept. Left empty as we don't really need the diagnostics @@ -1446,7 +1447,7 @@ private: template <typename Tuple, size_t... Is> - bool MatchAndExplainImpl(const Tuple& p, absl::index_sequence<Is...>) const { + bool MatchAndExplainImpl(const Tuple& p, std::index_sequence<Is...>) const { // Using std::min as a simple variadic "and". return std::min( {true, testing::SafeMatcherCast<
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 3372ea4..71f16df 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h
@@ -1909,9 +1909,9 @@ using value_type = typename PolicyTraits::value_type; using reference = value_type&; using const_reference = const value_type&; - using pointer = typename absl::allocator_traits< + using pointer = typename std::allocator_traits< allocator_type>::template rebind_traits<value_type>::pointer; - using const_pointer = typename absl::allocator_traits< + using const_pointer = typename std::allocator_traits< allocator_type>::template rebind_traits<value_type>::const_pointer; private: @@ -1975,15 +1975,15 @@ static_assert(sizeof(key_hash_result) >= sizeof(size_t), "`Hash::operator()` should return a `size_t`"); - using AllocTraits = absl::allocator_traits<allocator_type>; - using SlotAlloc = typename absl::allocator_traits< + using AllocTraits = std::allocator_traits<allocator_type>; + using SlotAlloc = typename std::allocator_traits< allocator_type>::template rebind_alloc<slot_type>; // People are often sloppy with the exact type of their allocator (sometimes // it has an extra const or is missing the pair, but rebinds made it work // anyway). using CharAlloc = - typename absl::allocator_traits<Alloc>::template rebind_alloc<char>; - using SlotAllocTraits = typename absl::allocator_traits< + typename std::allocator_traits<Alloc>::template rebind_alloc<char>; + using SlotAllocTraits = typename std::allocator_traits< allocator_type>::template rebind_traits<slot_type>; static_assert(std::is_lvalue_reference<reference>::value,
diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc index d34a056..59717ef 100644 --- a/absl/container/internal/raw_hash_set_test.cc +++ b/absl/container/internal/raw_hash_set_test.cc
@@ -389,13 +389,13 @@ template <class Allocator, class... Args> static void construct(Allocator* alloc, slot_type* slot, Args&&... args) { - absl::allocator_traits<Allocator>::construct(*alloc, slot, - std::forward<Args>(args)...); + std::allocator_traits<Allocator>::construct(*alloc, slot, + std::forward<Args>(args)...); } template <class Allocator> static void destroy(Allocator* alloc, slot_type* slot) { - absl::allocator_traits<Allocator>::destroy(*alloc, slot); + std::allocator_traits<Allocator>::destroy(*alloc, slot); } template <class Allocator> @@ -2308,7 +2308,7 @@ std::is_nothrow_move_assignable<std::equal_to<absl::string_view>>::value); ASSERT_TRUE(std::is_nothrow_move_assignable<std::allocator<int>>::value); ASSERT_TRUE( - absl::allocator_traits<std::allocator<int>>::is_always_equal::value); + std::allocator_traits<std::allocator<int>>::is_always_equal::value); EXPECT_TRUE(std::is_nothrow_move_assignable<StringTable>::value); }
diff --git a/absl/container/node_hash_map.h b/absl/container/node_hash_map.h index 6fe1d9f..e913005 100644 --- a/absl/container/node_hash_map.h +++ b/absl/container/node_hash_map.h
@@ -645,23 +645,22 @@ template <class Allocator, class... Args> static value_type* new_element(Allocator* alloc, Args&&... args) { - using PairAlloc = typename absl::allocator_traits< + using PairAlloc = typename std::allocator_traits< Allocator>::template rebind_alloc<value_type>; PairAlloc pair_alloc(*alloc); - value_type* res = - absl::allocator_traits<PairAlloc>::allocate(pair_alloc, 1); - absl::allocator_traits<PairAlloc>::construct(pair_alloc, res, - std::forward<Args>(args)...); + value_type* res = std::allocator_traits<PairAlloc>::allocate(pair_alloc, 1); + std::allocator_traits<PairAlloc>::construct(pair_alloc, res, + std::forward<Args>(args)...); return res; } template <class Allocator> static void delete_element(Allocator* alloc, value_type* pair) { - using PairAlloc = typename absl::allocator_traits< + using PairAlloc = typename std::allocator_traits< Allocator>::template rebind_alloc<value_type>; PairAlloc pair_alloc(*alloc); - absl::allocator_traits<PairAlloc>::destroy(pair_alloc, pair); - absl::allocator_traits<PairAlloc>::deallocate(pair_alloc, pair, 1); + std::allocator_traits<PairAlloc>::destroy(pair_alloc, pair); + std::allocator_traits<PairAlloc>::deallocate(pair_alloc, pair, 1); } template <class F, class... Args>
diff --git a/absl/container/node_hash_set.h b/absl/container/node_hash_set.h index 4d58098..8fd326b 100644 --- a/absl/container/node_hash_set.h +++ b/absl/container/node_hash_set.h
@@ -548,21 +548,21 @@ template <class Allocator, class... Args> static T* new_element(Allocator* alloc, Args&&... args) { using ValueAlloc = - typename absl::allocator_traits<Allocator>::template rebind_alloc<T>; + typename std::allocator_traits<Allocator>::template rebind_alloc<T>; ValueAlloc value_alloc(*alloc); - T* res = absl::allocator_traits<ValueAlloc>::allocate(value_alloc, 1); - absl::allocator_traits<ValueAlloc>::construct(value_alloc, res, - std::forward<Args>(args)...); + T* res = std::allocator_traits<ValueAlloc>::allocate(value_alloc, 1); + std::allocator_traits<ValueAlloc>::construct(value_alloc, res, + std::forward<Args>(args)...); return res; } template <class Allocator> static void delete_element(Allocator* alloc, T* elem) { using ValueAlloc = - typename absl::allocator_traits<Allocator>::template rebind_alloc<T>; + typename std::allocator_traits<Allocator>::template rebind_alloc<T>; ValueAlloc value_alloc(*alloc); - absl::allocator_traits<ValueAlloc>::destroy(value_alloc, elem); - absl::allocator_traits<ValueAlloc>::deallocate(value_alloc, elem, 1); + std::allocator_traits<ValueAlloc>::destroy(value_alloc, elem); + std::allocator_traits<ValueAlloc>::deallocate(value_alloc, elem, 1); } template <class F, class... Args>
diff --git a/absl/container/node_hash_set_test.cc b/absl/container/node_hash_set_test.cc index b29d0ca..ab40282 100644 --- a/absl/container/node_hash_set_test.cc +++ b/absl/container/node_hash_set_test.cc
@@ -75,11 +75,11 @@ } }; absl::node_hash_set<std::unique_ptr<int>, Hash, Eq> set1, set2; - set1.insert(absl::make_unique<int>(7)); - set1.insert(absl::make_unique<int>(17)); + set1.insert(std::make_unique<int>(7)); + set1.insert(std::make_unique<int>(17)); - set2.insert(absl::make_unique<int>(7)); - set2.insert(absl::make_unique<int>(19)); + set2.insert(std::make_unique<int>(7)); + set2.insert(std::make_unique<int>(19)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7), Pointee(19))); @@ -89,7 +89,7 @@ EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17), Pointee(19))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - auto node = set1.extract(absl::make_unique<int>(7)); + auto node = set1.extract(std::make_unique<int>(7)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(7)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(17), Pointee(19))); @@ -103,12 +103,12 @@ EXPECT_NE(insert_result.position->get(), insert_result.node.value().get()); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - node = set1.extract(absl::make_unique<int>(17)); + node = set1.extract(std::make_unique<int>(17)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(17)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(19))); - node.value() = absl::make_unique<int>(23); + node.value() = std::make_unique<int>(23); insert_result = set2.insert(std::move(node)); EXPECT_FALSE(node);
diff --git a/absl/crc/crc32c_benchmark.cc b/absl/crc/crc32c_benchmark.cc index d7cecc3..0ac9225 100644 --- a/absl/crc/crc32c_benchmark.cc +++ b/absl/crc/crc32c_benchmark.cc
@@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include <memory> #include <string> #include "absl/crc/crc32c.h" @@ -144,7 +145,7 @@ int string_len = state.range(0); std::string source = TestString(string_len); - auto dest = absl::make_unique<char[]>(string_len); + auto dest = std::make_unique<char[]>(string_len); for (auto s : state) { benchmark::DoNotOptimize(source);
diff --git a/absl/crc/internal/crc_x86_arm_combined.cc b/absl/crc/internal/crc_x86_arm_combined.cc index ebd9c3f..d639aec 100644 --- a/absl/crc/internal/crc_x86_arm_combined.cc +++ b/absl/crc/internal/crc_x86_arm_combined.cc
@@ -694,53 +694,53 @@ std::vector<std::unique_ptr<CRCImpl>> NewCRC32AcceleratedX86ARMCombinedAll() { auto ret = std::vector<std::unique_ptr<CRCImpl>>(); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 0, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 1, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 2, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 3, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 0, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 1, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 2, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 3, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 0, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 1, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 2, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 3, CutoffStrategy::Fold3>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 0, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 1, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 2, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 1, 3, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 0, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 1, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 2, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 2, 3, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 0, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 1, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 2, CutoffStrategy::Unroll64CRC>>()); - ret.push_back(absl::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< + ret.push_back(std::make_unique<CRC32AcceleratedX86ARMCombinedMultipleStreams< 3, 3, CutoffStrategy::Unroll64CRC>>()); return ret;
diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 1731197..9af2583 100644 --- a/absl/debugging/internal/demangle_test.cc +++ b/absl/debugging/internal/demangle_test.cc
@@ -15,6 +15,7 @@ #include "absl/debugging/internal/demangle.h" #include <cstdlib> +#include <memory> #include <string> #include "gmock/gmock.h" @@ -2000,7 +2001,7 @@ static void TestOnInput(const char* input) { static const int kOutSize = 1048576; - auto out = absl::make_unique<char[]>(kOutSize); + auto out = std::make_unique<char[]>(kOutSize); Demangle(input, out.get(), kOutSize); }
diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc index 5eb68e0..2862394 100644 --- a/absl/debugging/symbolize_test.cc +++ b/absl/debugging/symbolize_test.cc
@@ -136,7 +136,7 @@ << "try_symbolize_buffer is too small"; // Use the heap to facilitate heap and buffer sanitizer tools. - auto heap_buffer = absl::make_unique<char[]>(sizeof(try_symbolize_buffer)); + auto heap_buffer = std::make_unique<char[]>(sizeof(try_symbolize_buffer)); bool found = absl::Symbolize(pc, heap_buffer.get(), limit); if (found) { CHECK_LT(static_cast<int>(
diff --git a/absl/flags/commandlineflag_test.cc b/absl/flags/commandlineflag_test.cc index 54700cf..b6d01b2 100644 --- a/absl/flags/commandlineflag_test.cc +++ b/absl/flags/commandlineflag_test.cc
@@ -55,7 +55,7 @@ #if ABSL_FLAGS_STRIP_NAMES GTEST_SKIP() << "This test requires flag names to be present"; #endif - flag_saver_ = absl::make_unique<absl::FlagSaver>(); + flag_saver_ = std::make_unique<absl::FlagSaver>(); } void TearDown() override { flag_saver_.reset(); }
diff --git a/absl/flags/internal/flag.cc b/absl/flags/internal/flag.cc index 8e89425..0a1dff2 100644 --- a/absl/flags/internal/flag.cc +++ b/absl/flags/internal/flag.cc
@@ -443,7 +443,7 @@ switch (ValueStorageKind()) { case FlagValueStorageKind::kValueAndInitBit: case FlagValueStorageKind::kOneWordAtomic: { - return absl::make_unique<FlagState>( + return std::make_unique<FlagState>( *this, OneWordValue().load(std::memory_order_acquire), modified, on_command_line, ModificationCount()); } @@ -454,11 +454,11 @@ seq_lock_.TryRead(cloned, AtomicBufferValue(), Sizeof(op_)); assert(success); static_cast<void>(success); - return absl::make_unique<FlagState>(*this, cloned, modified, - on_command_line, ModificationCount()); + return std::make_unique<FlagState>(*this, cloned, modified, + on_command_line, ModificationCount()); } case FlagValueStorageKind::kHeapAllocated: { - return absl::make_unique<FlagState>( + return std::make_unique<FlagState>( *this, flags_internal::Clone( op_, PtrStorage().load(std::memory_order_acquire).Ptr()),
diff --git a/absl/flags/internal/flag.h b/absl/flags/internal/flag.h index e26b2ad..9771559 100644 --- a/absl/flags/internal/flag.h +++ b/absl/flags/internal/flag.h
@@ -178,7 +178,7 @@ template <size_t... I> static constexpr FixedCharArray<N> FromLiteralString( - absl::string_view str, absl::index_sequence<I...>) { + absl::string_view str, std::index_sequence<I...>) { return (void)str, FixedCharArray<N>({{str[I]..., '\0'}}); } }; @@ -186,7 +186,7 @@ template <typename Gen, size_t N = Gen::Value().size()> constexpr FixedCharArray<N + 1> HelpStringAsArray(int) { return FixedCharArray<N + 1>::FromLiteralString( - Gen::Value(), absl::make_index_sequence<N>{}); + Gen::Value(), std::make_index_sequence<N>{}); } template <typename Gen>
diff --git a/absl/flags/reflection_test.cc b/absl/flags/reflection_test.cc index 68abeda..996a458 100644 --- a/absl/flags/reflection_test.cc +++ b/absl/flags/reflection_test.cc
@@ -38,7 +38,7 @@ #if ABSL_FLAGS_STRIP_NAMES GTEST_SKIP() << "This test requires flag names to be present"; #endif - flag_saver_ = absl::make_unique<absl::FlagSaver>(); + flag_saver_ = std::make_unique<absl::FlagSaver>(); } void TearDown() override { flag_saver_.reset(); }
diff --git a/absl/functional/BUILD.bazel b/absl/functional/BUILD.bazel index dcf808b..5e85523 100644 --- a/absl/functional/BUILD.bazel +++ b/absl/functional/BUILD.bazel
@@ -71,6 +71,32 @@ ) cc_library( + name = "bind_back", + srcs = ["internal/back_binder.h"], + hdrs = ["bind_back.h"], + copts = ABSL_DEFAULT_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, + deps = [ + "//absl/base:config", + "//absl/container:compressed_tuple", + "//absl/utility", + ], +) + +cc_test( + name = "bind_back_test", + srcs = ["bind_back_test.cc"], + copts = ABSL_TEST_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, + deps = [ + ":bind_back", + "//absl/memory", + "@googletest//:gtest", + "@googletest//:gtest_main", + ], +) + +cc_library( name = "bind_front", srcs = ["internal/front_binder.h"], hdrs = ["bind_front.h"],
diff --git a/absl/functional/CMakeLists.txt b/absl/functional/CMakeLists.txt index 4ffb513..362c149 100644 --- a/absl/functional/CMakeLists.txt +++ b/absl/functional/CMakeLists.txt
@@ -52,6 +52,35 @@ absl_cc_library( NAME + bind_back + SRCS + "internal/back_binder.h" + HDRS + "bind_back.h" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::compressed_tuple + absl::config + absl::utility + PUBLIC +) + +absl_cc_test( + NAME + bind_back_test + SRCS + "bind_back_test.cc" + COPTS + ${ABSL_DEFAULT_COPTS} + DEPS + absl::bind_back + absl::memory + GTest::gmock_main +) + +absl_cc_library( + NAME bind_front SRCS "internal/front_binder.h"
diff --git a/absl/functional/any_invocable.h b/absl/functional/any_invocable.h index 4ba4fe3..2fddb72 100644 --- a/absl/functional/any_invocable.h +++ b/absl/functional/any_invocable.h
@@ -203,14 +203,13 @@ // Example: // // AnyInvocable<int(int)> func( - // absl::in_place_type<PossiblyImmovableType>, arg1, arg2); + // std::in_place_type<PossiblyImmovableType>, arg1, arg2); // template <class T, class... Args, typename = std::enable_if_t< internal_any_invocable::CanEmplace<Sig, T, Args...>::value>> - explicit AnyInvocable(absl::in_place_type_t<T>, Args&&... args) - : Impl(absl::in_place_type<std::decay_t<T>>, - std::forward<Args>(args)...) { + explicit AnyInvocable(std::in_place_type_t<T>, Args&&... args) + : Impl(std::in_place_type<std::decay_t<T>>, std::forward<Args>(args)...) { static_assert(std::is_same<T, std::decay_t<T>>::value, "The explicit template argument of in_place_type is required " "to be an unqualified object type."); @@ -220,9 +219,9 @@ template <class T, class U, class... Args, typename = std::enable_if_t<internal_any_invocable::CanEmplace< Sig, T, std::initializer_list<U>&, Args...>::value>> - explicit AnyInvocable(absl::in_place_type_t<T>, - std::initializer_list<U> ilist, Args&&... args) - : Impl(absl::in_place_type<std::decay_t<T>>, ilist, + explicit AnyInvocable(std::in_place_type_t<T>, std::initializer_list<U> ilist, + Args&&... args) + : Impl(std::in_place_type<std::decay_t<T>>, ilist, std::forward<Args>(args)...) { static_assert(std::is_same<T, std::decay_t<T>>::value, "The explicit template argument of in_place_type is required "
diff --git a/absl/functional/any_invocable_test.cc b/absl/functional/any_invocable_test.cc index 46082ca..77a785a 100644 --- a/absl/functional/any_invocable_test.cc +++ b/absl/functional/any_invocable_test.cc
@@ -567,7 +567,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 5); EXPECT_TRUE(static_cast<bool>(fun)); EXPECT_EQ(29, TypeParam::ToThisParam(fun)(7, 8, 9).value); @@ -577,7 +577,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type<AddType>, {1, 2, 3, 4}, 5); + AnyInvType fun(std::in_place_type<AddType>, {1, 2, 3, 4}, 5); EXPECT_TRUE(static_cast<bool>(fun)); EXPECT_EQ(39, TypeParam::ToThisParam(fun)(7, 8, 9).value); @@ -587,7 +587,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using UnqualifiedFunType = typename TypeParam::UnqualifiedFunType; - AnyInvType fun(absl::in_place_type<UnqualifiedFunType*>, nullptr); + AnyInvType fun(std::in_place_type<UnqualifiedFunType*>, nullptr); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast<bool>(fun)); @@ -597,7 +597,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using UnqualifiedFunType = typename TypeParam::UnqualifiedFunType; - AnyInvType fun(absl::in_place_type<UnqualifiedFunType*>); + AnyInvType fun(std::in_place_type<UnqualifiedFunType*>); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast<bool>(fun)); @@ -607,7 +607,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using MemFunPtrType = typename TypeParam::MemFunPtrType; - AnyInvType fun(absl::in_place_type<MemFunPtrType>, nullptr); + AnyInvType fun(std::in_place_type<MemFunPtrType>, nullptr); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast<bool>(fun)); @@ -617,7 +617,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using MemFunPtrType = typename TypeParam::MemFunPtrType; - AnyInvType fun(absl::in_place_type<MemFunPtrType>); + AnyInvType fun(std::in_place_type<MemFunPtrType>); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast<bool>(fun)); @@ -627,7 +627,7 @@ using UnaryAnyInvType = typename TypeParam::UnaryAnyInvType; using MemObjPtrType = typename TypeParam::MemObjPtrType; - UnaryAnyInvType fun(absl::in_place_type<MemObjPtrType>, nullptr); + UnaryAnyInvType fun(std::in_place_type<MemObjPtrType>, nullptr); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast<bool>(fun)); @@ -637,7 +637,7 @@ using UnaryAnyInvType = typename TypeParam::UnaryAnyInvType; using MemObjPtrType = typename TypeParam::MemObjPtrType; - UnaryAnyInvType fun(absl::in_place_type<MemObjPtrType>); + UnaryAnyInvType fun(std::in_place_type<MemObjPtrType>); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast<bool>(fun)); @@ -647,7 +647,7 @@ using VoidAnyInvType = typename TypeParam::VoidAnyInvType; using AddType = typename TypeParam::AddType; - VoidAnyInvType fun(absl::in_place_type<AddType>, 5); + VoidAnyInvType fun(std::in_place_type<AddType>, 5); EXPECT_TRUE(static_cast<bool>(fun)); } @@ -667,7 +667,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type<AddType>, 5); + AnyInvType source_fun(std::in_place_type<AddType>, 5); AnyInvType fun(std::move(source_fun)); EXPECT_TRUE(static_cast<bool>(fun)); @@ -692,7 +692,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 5); EXPECT_FALSE(fun == nullptr); EXPECT_FALSE(nullptr == fun); @@ -729,7 +729,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type<AddType>, 5); + AnyInvType source_fun(std::in_place_type<AddType>, 5); AnyInvType fun; fun = std::move(source_fun); @@ -743,7 +743,7 @@ using AddType = typename TypeParam::AddType; AnyInvType source_fun; - AnyInvType fun(absl::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 5); fun = std::move(source_fun); @@ -754,8 +754,8 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type<AddType>, 5); - AnyInvType fun(absl::in_place_type<AddType>, 20); + AnyInvType source_fun(std::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 20); fun = std::move(source_fun); @@ -776,7 +776,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type<AddType>, 5); + AnyInvType source_fun(std::in_place_type<AddType>, 5); source_fun = std::move(source_fun); // This space intentionally left blank. @@ -1027,7 +1027,7 @@ // Swap idiom { AnyInvType fun; - AnyInvType other(absl::in_place_type<AddType>, 5); + AnyInvType other(std::in_place_type<AddType>, 5); using std::swap; swap(fun, other); @@ -1044,7 +1044,7 @@ // Member swap { AnyInvType fun; - AnyInvType other(absl::in_place_type<AddType>, 5); + AnyInvType other(std::in_place_type<AddType>, 5); fun.swap(other); @@ -1063,7 +1063,7 @@ // Swap idiom { - AnyInvType fun(absl::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 5); AnyInvType other; using std::swap; @@ -1080,7 +1080,7 @@ // Member swap { - AnyInvType fun(absl::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 5); AnyInvType other; fun.swap(other); @@ -1100,8 +1100,8 @@ // Swap idiom { - AnyInvType fun(absl::in_place_type<AddType>, 5); - AnyInvType other(absl::in_place_type<AddType>, 6); + AnyInvType fun(std::in_place_type<AddType>, 5); + AnyInvType other(std::in_place_type<AddType>, 6); using std::swap; swap(fun, other); @@ -1118,8 +1118,8 @@ // Member swap { - AnyInvType fun(absl::in_place_type<AddType>, 5); - AnyInvType other(absl::in_place_type<AddType>, 6); + AnyInvType fun(std::in_place_type<AddType>, 5); + AnyInvType other(std::in_place_type<AddType>, 6); fun.swap(other); @@ -1383,7 +1383,7 @@ using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type<AddType>, 5); + AnyInvType fun(std::in_place_type<AddType>, 5); EXPECT_TRUE(static_cast<bool>(fun)); std::move(fun)(7, 8, 9);
diff --git a/absl/functional/bind_back.h b/absl/functional/bind_back.h new file mode 100644 index 0000000..ba31fb4 --- /dev/null +++ b/absl/functional/bind_back.h
@@ -0,0 +1,79 @@ +// Copyright 2026 The Abseil Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ----------------------------------------------------------------------------- +// File: bind_back.h +// ----------------------------------------------------------------------------- +// +// `absl::bind_back()` returns a functor by binding a number of arguments to +// the back of a provided (usually more generic) functor. Unlike `std::bind`, +// it does not require the use of argument placeholders. The simpler syntax of +// `absl::bind_back()` allows you to avoid known misuses with `std::bind()`. +// +// `absl::bind_back()` is meant as a drop-in replacement for C++23's +// `std::bind_back()`, which similarly resolves these issues with +// `std::bind()`. Both `bind_back()` alternatives, unlike `std::bind()`, allow +// partial function application. (See +// https://en.wikipedia.org/wiki/Partial_application). + +#ifndef ABSL_FUNCTIONAL_BIND_BACK_H_ +#define ABSL_FUNCTIONAL_BIND_BACK_H_ + +#ifdef __has_include +#if __has_include(<version>) +#include <version> +#endif +#endif + +#if defined(__cpp_lib_bind_back) && __cpp_lib_bind_back >= 202202L +#include <functional> // For std::bind_back. +#endif + +#include <utility> + +#include "absl/base/config.h" +#include "absl/functional/internal/back_binder.h" +#include "absl/utility/utility.h" + +namespace absl { +ABSL_NAMESPACE_BEGIN + +// bind_back() +// +// Binds the last N arguments of an invocable object and stores them by value. +// +// Like `std::bind()`, `absl::bind_back()` is implicitly convertible to +// `std::function`. In particular, it may be used as a simpler replacement for +// `std::bind()` in most cases, as it does not require placeholders to be +// specified. More importantly, it provides more reliable correctness guarantees +// than `std::bind()`; while `std::bind()` will silently ignore passing more +// parameters than expected, for example, `absl::bind_back()` will report such +// mis-uses as errors. In C++23, `absl::bind_back` is replaced by +// `std::bind_back`. +// +#if defined(__cpp_lib_bind_back) && __cpp_lib_bind_back >= 202202L +using std::bind_back; +#else +template <class F, class... BoundArgs> +constexpr functional_internal::bind_back_t<F, BoundArgs...> bind_back( + F&& func, BoundArgs&&... args) { + return functional_internal::bind_back_t<F, BoundArgs...>( + std::in_place, std::forward<F>(func), std::forward<BoundArgs>(args)...); +} +#endif + +ABSL_NAMESPACE_END +} // namespace absl + +#endif // ABSL_FUNCTIONAL_BIND_BACK_H_
diff --git a/absl/functional/bind_back_test.cc b/absl/functional/bind_back_test.cc new file mode 100644 index 0000000..77accc4 --- /dev/null +++ b/absl/functional/bind_back_test.cc
@@ -0,0 +1,237 @@ +// Copyright 2026 The Abseil Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "absl/functional/bind_back.h" + +#include <stddef.h> + +#include <functional> +#include <memory> +#include <string> +#include <utility> + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "absl/memory/memory.h" + +namespace { + +char CharAt(const char* s, size_t index) { return s[index]; } + +TEST(BindTest, Basics) { + EXPECT_EQ('C', absl::bind_back(CharAt)("ABC", 2)); + EXPECT_EQ('C', absl::bind_back(CharAt, 2)("ABC")); + EXPECT_EQ('C', absl::bind_back(CharAt, "ABC", 2)()); +} + +TEST(BindTest, Lambda) { + auto lambda = [](int x, int y, int z) { return x + y + z; }; + EXPECT_EQ(6, absl::bind_back(lambda)(1, 2, 3)); + EXPECT_EQ(6, absl::bind_back(lambda, 3)(1, 2)); + EXPECT_EQ(6, absl::bind_back(lambda, 2, 3)(1)); + EXPECT_EQ(6, absl::bind_back(lambda, 1, 2, 3)()); +} + +struct Functor { + std::string operator()() & { return "&"; } + std::string operator()() const& { return "const&"; } + std::string operator()() && { return "&&"; } + std::string operator()() const&& { return "const&&"; } +}; + +TEST(BindTest, PerfectForwardingOfBoundArgs) { + auto f = absl::bind_back(Functor()); + const auto& cf = f; + EXPECT_EQ("&", f()); + EXPECT_EQ("const&", cf()); + EXPECT_EQ("&&", std::move(f)()); + EXPECT_EQ("const&&", std::move(cf)()); +} + +struct ArgDescribe { + std::string operator()(int&) const { return "&"; } // NOLINT + std::string operator()(const int&) const { return "const&"; } // NOLINT + std::string operator()(int&&) const { return "&&"; } + std::string operator()(const int&&) const { return "const&&"; } +}; + +TEST(BindTest, PerfectForwardingOfFreeArgs) { + ArgDescribe f; + int i; + EXPECT_EQ("&", absl::bind_back(f)(static_cast<int&>(i))); + EXPECT_EQ("const&", absl::bind_back(f)(static_cast<const int&>(i))); + EXPECT_EQ("&&", absl::bind_back(f)(static_cast<int&&>(i))); + EXPECT_EQ("const&&", absl::bind_back(f)(static_cast<const int&&>(i))); +} + +struct NonCopyableFunctor { + NonCopyableFunctor() = default; + NonCopyableFunctor(const NonCopyableFunctor&) = delete; + NonCopyableFunctor& operator=(const NonCopyableFunctor&) = delete; + const NonCopyableFunctor* operator()() const { return this; } +}; + +TEST(BindTest, RefToFunctor) { + // It won't copy/move the functor and use the original object. + NonCopyableFunctor ncf; + auto bound_ncf = absl::bind_back(std::ref(ncf)); + auto bound_ncf_copy = bound_ncf; + EXPECT_EQ(&ncf, bound_ncf_copy()); +} + +struct Struct { + std::string value; +}; + +TEST(BindTest, StoreByCopy) { + Struct s = {"hello"}; + auto f = absl::bind_back(&Struct::value, s); + auto g = f; + EXPECT_EQ("hello", f()); + EXPECT_EQ("hello", g()); + EXPECT_NE(&s.value, &f()); + EXPECT_NE(&s.value, &g()); + EXPECT_NE(&g(), &f()); +} + +struct NonCopyable { + explicit NonCopyable(const std::string& s) : value(s) {} + NonCopyable(const NonCopyable&) = delete; + NonCopyable& operator=(const NonCopyable&) = delete; + + std::string value; +}; + +const std::string& GetNonCopyableValue(const NonCopyable& n) { return n.value; } + +TEST(BindTest, StoreByRef) { + NonCopyable s("hello"); + auto f = absl::bind_back(&GetNonCopyableValue, std::ref(s)); + EXPECT_EQ("hello", f()); + EXPECT_EQ(&s.value, &f()); + auto g = std::move(f); // NOLINT + EXPECT_EQ("hello", g()); + EXPECT_EQ(&s.value, &g()); + s.value = "goodbye"; + EXPECT_EQ("goodbye", g()); +} + +TEST(BindTest, StoreByCRef) { + NonCopyable s("hello"); + auto f = absl::bind_back(&GetNonCopyableValue, std::cref(s)); + EXPECT_EQ("hello", f()); + EXPECT_EQ(&s.value, &f()); + auto g = std::move(f); // NOLINT + EXPECT_EQ("hello", g()); + EXPECT_EQ(&s.value, &g()); + s.value = "goodbye"; + EXPECT_EQ("goodbye", g()); +} + +const std::string& GetNonCopyableValueByWrapper( + std::reference_wrapper<NonCopyable> n) { + return n.get().value; +} + +TEST(BindTest, StoreByRefInvokeByWrapper) { + NonCopyable s("hello"); + auto f = absl::bind_back(GetNonCopyableValueByWrapper, std::ref(s)); + EXPECT_EQ("hello", f()); + EXPECT_EQ(&s.value, &f()); + auto g = std::move(f); + EXPECT_EQ("hello", g()); + EXPECT_EQ(&s.value, &g()); + s.value = "goodbye"; + EXPECT_EQ("goodbye", g()); +} + +TEST(BindTest, StoreByPointer) { + NonCopyable s("hello"); + auto f = absl::bind_back(&NonCopyable::value, &s); + EXPECT_EQ("hello", f()); + EXPECT_EQ(&s.value, &f()); + auto g = std::move(f); + EXPECT_EQ("hello", g()); + EXPECT_EQ(&s.value, &g()); +} + +struct MyStruct { + int x; + int Add(int y) const { return x + y; } +}; + +TEST(BindTest, MemberFunctionFreeInstance) { + MyStruct s{10}; + auto f = absl::bind_back(&MyStruct::Add, 5); + EXPECT_EQ(f(s), 15); +} + +int Sink(std::unique_ptr<int> p) { return *p; } + +std::unique_ptr<int> Factory(int n) { return std::make_unique<int>(n); } + +TEST(BindTest, NonCopyableArg) { + EXPECT_EQ(42, absl::bind_back(Sink)(std::make_unique<int>(42))); + EXPECT_EQ(42, absl::bind_back(Sink, std::make_unique<int>(42))()); +} + +TEST(BindTest, NonCopyableResult) { + EXPECT_THAT(absl::bind_back(Factory)(42), ::testing::Pointee(42)); + EXPECT_THAT(absl::bind_back(Factory, 42)(), ::testing::Pointee(42)); +} + +// is_copy_constructible<FalseCopyable<unique_ptr<T>> is true but an attempt to +// instantiate the copy constructor leads to a compile error. This is similar +// to how standard containers behave. +template <class T> +struct FalseCopyable { + FalseCopyable() = default; + FalseCopyable(const FalseCopyable& other) : m(other.m) {} + FalseCopyable(FalseCopyable&& other) : m(std::move(other.m)) {} + T m; +}; + +int GetMember(FalseCopyable<std::unique_ptr<int>> x) { return *x.m; } + +TEST(BindTest, WrappedMoveOnly) { + FalseCopyable<std::unique_ptr<int>> x; + x.m = std::make_unique<int>(42); + auto f = absl::bind_back(&GetMember, std::move(x)); + EXPECT_EQ(42, std::move(f)()); +} + +int Plus(int a, int b) { return a + b; } + +TEST(BindTest, ConstExpr) { + constexpr auto f = absl::bind_back(CharAt); + EXPECT_EQ(f("ABC", 1), 'B'); + static constexpr int five = 5; + constexpr auto plus5 = absl::bind_back(Plus, five); + EXPECT_EQ(plus5(1), 6); + + static constexpr char data[] = "DEF"; + constexpr auto g = absl::bind_back(CharAt, 1); + EXPECT_EQ(g(data), 'E'); +} + +struct ManglingCall { + int operator()(int, double, std::string) const { return 0; } +}; + +TEST(BindTest, Mangling) { + // We just want to generate a particular instantiation to see its mangling. + absl::bind_back(ManglingCall{}, 3.3, "A")(1); +} + +} // namespace
diff --git a/absl/functional/bind_front.h b/absl/functional/bind_front.h index 594e773..09adc09 100644 --- a/absl/functional/bind_front.h +++ b/absl/functional/bind_front.h
@@ -190,7 +190,7 @@ constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front( F&& func, BoundArgs&&... args) { return functional_internal::bind_front_t<F, BoundArgs...>( - absl::in_place, std::forward<F>(func), std::forward<BoundArgs>(args)...); + std::in_place, std::forward<F>(func), std::forward<BoundArgs>(args)...); } #endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L
diff --git a/absl/functional/bind_front_test.cc b/absl/functional/bind_front_test.cc index 5d94ecc..a759dbe 100644 --- a/absl/functional/bind_front_test.cc +++ b/absl/functional/bind_front_test.cc
@@ -169,11 +169,11 @@ return *p; } -std::unique_ptr<int> Factory(int n) { return absl::make_unique<int>(n); } +std::unique_ptr<int> Factory(int n) { return std::make_unique<int>(n); } TEST(BindTest, NonCopyableArg) { - EXPECT_EQ(42, absl::bind_front(Sink)(absl::make_unique<int>(42))); - EXPECT_EQ(42, absl::bind_front(Sink, absl::make_unique<int>(42))()); + EXPECT_EQ(42, absl::bind_front(Sink)(std::make_unique<int>(42))); + EXPECT_EQ(42, absl::bind_front(Sink, std::make_unique<int>(42))()); } TEST(BindTest, NonCopyableResult) { @@ -196,7 +196,7 @@ TEST(BindTest, WrappedMoveOnly) { FalseCopyable<std::unique_ptr<int>> x; - x.m = absl::make_unique<int>(42); + x.m = std::make_unique<int>(42); auto f = absl::bind_front(&GetMember, std::move(x)); EXPECT_EQ(42, std::move(f)()); }
diff --git a/absl/functional/function_ref_test.cc b/absl/functional/function_ref_test.cc index 97aa3d5..81da61a 100644 --- a/absl/functional/function_ref_test.cc +++ b/absl/functional/function_ref_test.cc
@@ -83,11 +83,11 @@ TEST(FunctionRefTest, ForwardsArgs) { auto l = [](std::unique_ptr<int> i) { return *i; }; FunctionRef<int(std::unique_ptr<int>)> ref(l); - EXPECT_EQ(42, ref(absl::make_unique<int>(42))); + EXPECT_EQ(42, ref(std::make_unique<int>(42))); } TEST(FunctionRef, ReturnMoveOnly) { - auto l = [] { return absl::make_unique<int>(29); }; + auto l = [] { return std::make_unique<int>(29); }; FunctionRef<std::unique_ptr<int>()> ref(l); EXPECT_EQ(29, *ref()); }
diff --git a/absl/functional/internal/any_invocable.h b/absl/functional/internal/any_invocable.h index db73fff..262385a 100644 --- a/absl/functional/internal/any_invocable.h +++ b/absl/functional/internal/any_invocable.h
@@ -342,12 +342,12 @@ //////////////////////////////////////////////////////////////////////////////// // // A metafunction that checks if a type T is an instantiation of -// absl::in_place_type_t (needed for constructor constraints of AnyInvocable). +// std::in_place_type_t (needed for constructor constraints of AnyInvocable). template <class T> struct IsInPlaceType : std::false_type {}; template <class T> -struct IsInPlaceType<absl::in_place_type_t<T>> : std::true_type {}; +struct IsInPlaceType<std::in_place_type_t<T>> : std::true_type {}; // //////////////////////////////////////////////////////////////////////////////// @@ -464,7 +464,7 @@ // invocation of the Invocable. The unqualified type is the target object // type to be stored. template <class QualTRef, class... Args> - explicit CoreImpl(absl::in_place_type_t<QualTRef>, Args&&... args) { + explicit CoreImpl(std::in_place_type_t<QualTRef>, Args&&... args) { InitializeStorage<QualTRef>(std::forward<Args>(args)...); } @@ -607,7 +607,7 @@ // substitution failures happen when forming the template arguments. template <class... T> using TrueAlias = - std::integral_constant<bool, sizeof(std::void_t<T...>*) != 0>; + std::integral_constant<bool, sizeof(absl::void_t<T...>*) != 0>; /*SFINAE constraints for the conversion-constructor.*/ template <class Sig, class F, @@ -696,11 +696,11 @@ \ /*SFINAE constraint to check if F is invocable with the proper signature*/ \ template <class F> \ - using CallIsValid = TrueAlias<std::enable_if_t<std::disjunction< \ - std::is_invocable_r<ReturnType, std::decay_t<F> inv_quals, P...>, \ - std::is_same< \ - ReturnType, \ - std::invoke_result_t<std::decay_t<F> inv_quals, P...>>>::value>>; \ + using CallIsValid = TrueAlias<std::enable_if_t<std::disjunction< \ + std::is_invocable_r<ReturnType, std::decay_t<F> inv_quals, P...>, \ + std::is_same<ReturnType, \ + std::invoke_result_t<std::decay_t<F> inv_quals, P...>>>:: \ + value>>; \ \ /*SFINAE constraint to check if F is nothrow-invocable when necessary*/ \ template <class F> \ @@ -722,8 +722,8 @@ \ /*Forward along the in-place construction parameters.*/ \ template <class T, class... Args> \ - explicit Impl(absl::in_place_type_t<T>, Args&&... args) \ - : Core(absl::in_place_type<std::decay_t<T> inv_quals>, \ + explicit Impl(std::in_place_type_t<T>, Args&&... args) \ + : Core(std::in_place_type<std::decay_t<T> inv_quals>, \ std::forward<Args>(args)...) {} \ \ /*Raises a fatal error when the AnyInvocable is invoked after a move*/ \
diff --git a/absl/functional/internal/back_binder.h b/absl/functional/internal/back_binder.h new file mode 100644 index 0000000..71cfc7a --- /dev/null +++ b/absl/functional/internal/back_binder.h
@@ -0,0 +1,95 @@ +// Copyright 2026 The Abseil Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Implementation details for `absl::bind_back()`. + +#ifndef ABSL_FUNCTIONAL_INTERNAL_BACK_BINDER_H_ +#define ABSL_FUNCTIONAL_INTERNAL_BACK_BINDER_H_ + +#include <cstddef> +#include <type_traits> +#include <utility> + +#include "absl/base/config.h" +#include "absl/container/internal/compressed_tuple.h" +#include "absl/utility/utility.h" + +namespace absl { +ABSL_NAMESPACE_BEGIN +namespace functional_internal { + +// Invoke the method, expanding the tuple of bound arguments. +template <class R, class Tuple, size_t... Idx, class... Args> +constexpr R ApplyBack(Tuple&& bound, std::index_sequence<Idx...>, + Args&&... free) { + return std::invoke(std::forward<Tuple>(bound).template get<0>(), + std::forward<Args>(free)..., + std::forward<Tuple>(bound).template get<Idx + 1>()...); +} + +template <class F, class... BoundArgs> +class BackBinder { + using BoundArgsT = absl::container_internal::CompressedTuple<F, BoundArgs...>; + using Idx = std::make_index_sequence<sizeof...(BoundArgs)>; + + BoundArgsT bound_args_; + + public: + template <class... Ts> + constexpr explicit BackBinder(std::in_place_t, Ts&&... ts) + : bound_args_(std::forward<Ts>(ts)...) {} + + template <class... FreeArgs, + class R = std::invoke_result_t<F&, FreeArgs&&..., BoundArgs&...>> + constexpr R operator()(FreeArgs&&... free_args) & { + return functional_internal::ApplyBack<R>( + bound_args_, Idx(), std::forward<FreeArgs>(free_args)...); + } + + template <class... FreeArgs, + class R = std::invoke_result_t<const F&, FreeArgs&&..., + const BoundArgs&...>> + constexpr R operator()(FreeArgs&&... free_args) const& { + return functional_internal::ApplyBack<R>( + bound_args_, Idx(), std::forward<FreeArgs>(free_args)...); + } + + template <class... FreeArgs, + class R = std::invoke_result_t<F&&, FreeArgs&&..., BoundArgs&&...>> + constexpr R operator()(FreeArgs&&... free_args) && { + // This overload is called when *this is an rvalue. If some of the bound + // arguments are stored by value or rvalue reference, we move them. + return functional_internal::ApplyBack<R>( + std::move(bound_args_), Idx(), std::forward<FreeArgs>(free_args)...); + } + + template <class... FreeArgs, + class R = std::invoke_result_t<const F&&, FreeArgs&&..., + const BoundArgs&&...>> + constexpr R operator()(FreeArgs&&... free_args) const&& { + // This overload is called when *this is an rvalue. If some of the bound + // arguments are stored by value or rvalue reference, we move them. + return functional_internal::ApplyBack<R>( + std::move(bound_args_), Idx(), std::forward<FreeArgs>(free_args)...); + } +}; + +template <class F, class... BoundArgs> +using bind_back_t = BackBinder<std::decay_t<F>, std::decay_t<BoundArgs>...>; + +} // namespace functional_internal +ABSL_NAMESPACE_END +} // namespace absl + +#endif // ABSL_FUNCTIONAL_INTERNAL_BACK_BINDER_H_
diff --git a/absl/functional/internal/front_binder.h b/absl/functional/internal/front_binder.h index 28a15ce..d0c3a5a 100644 --- a/absl/functional/internal/front_binder.h +++ b/absl/functional/internal/front_binder.h
@@ -31,7 +31,7 @@ // Invoke the method, expanding the tuple of bound arguments. template <class R, class Tuple, size_t... Idx, class... Args> -R Apply(Tuple&& bound, absl::index_sequence<Idx...>, Args&&... free) { +R Apply(Tuple&& bound, std::index_sequence<Idx...>, Args&&... free) { return std::invoke(std::forward<Tuple>(bound).template get<Idx>()..., std::forward<Args>(free)...); } @@ -39,13 +39,13 @@ template <class F, class... BoundArgs> class FrontBinder { using BoundArgsT = absl::container_internal::CompressedTuple<F, BoundArgs...>; - using Idx = absl::make_index_sequence<sizeof...(BoundArgs) + 1>; + using Idx = std::make_index_sequence<sizeof...(BoundArgs) + 1>; BoundArgsT bound_args_; public: template <class... Ts> - constexpr explicit FrontBinder(absl::in_place_t, Ts&&... ts) + constexpr explicit FrontBinder(std::in_place_t, Ts&&... ts) : bound_args_(std::forward<Ts>(ts)...) {} template <class... FreeArgs,
diff --git a/absl/hash/hash_test.cc b/absl/hash/hash_test.cc index 4aead98..d888660 100644 --- a/absl/hash/hash_test.cc +++ b/absl/hash/hash_test.cc
@@ -365,7 +365,7 @@ EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly( std::forward_as_tuple(&i, nullptr, // unique1, unique2, unique_null, // - absl::make_unique<int>(), // + std::make_unique<int>(), // shared1, shared2, shared_null, // std::make_shared<int>()), SmartPointerEq{}));
diff --git a/absl/hash/hash_testing.h b/absl/hash/hash_testing.h index 3740ba9..66a1545 100644 --- a/absl/hash/hash_testing.h +++ b/absl/hash/hash_testing.h
@@ -20,6 +20,7 @@ #include <string> #include <tuple> #include <type_traits> +#include <utility> #include <variant> #include <vector> @@ -131,7 +132,7 @@ // } // friend bool operator==(Bad4 x, Bad4 y) { // // Compare two ranges for equality. C++14 code can instead use std::equal. -// return absl::equal(x.p, x.p + x.size, y.p, y.p + y.size); +// return std::equal(x.p, x.p + x.size, y.p, y.p + y.size); // } // }; // @@ -321,12 +322,12 @@ using Out = std::vector<V>; template <size_t... I> - static Out DoImpl(const std::tuple<T...>& tuple, absl::index_sequence<I...>) { + static Out DoImpl(const std::tuple<T...>& tuple, std::index_sequence<I...>) { return Out{&std::get<I>(tuple)...}; } static Out Do(const std::tuple<T...>& values) { - return DoImpl(values, absl::index_sequence_for<T...>()); + return DoImpl(values, std::index_sequence_for<T...>()); } };
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 760dd8c..8837679 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h
@@ -604,7 +604,7 @@ // Helper function for hashing a tuple. The third argument should // be an index_sequence running from 0 to tuple_size<Tuple> - 1. template <typename H, typename Tuple, size_t... Is> -H hash_tuple(H hash_state, const Tuple& t, absl::index_sequence<Is...>) { +H hash_tuple(H hash_state, const Tuple& t, std::index_sequence<Is...>) { return H::combine(std::move(hash_state), std::get<Is>(t)...); } @@ -619,7 +619,7 @@ #endif // _MSC_VER AbslHashValue(H hash_state, const std::tuple<Ts...>& t) { return hash_internal::hash_tuple(std::move(hash_state), t, - absl::make_index_sequence<sizeof...(Ts)>()); + std::make_index_sequence<sizeof...(Ts)>()); } // -----------------------------------------------------------------------------
diff --git a/absl/log/internal/log_message.cc b/absl/log/internal/log_message.cc index 6c2350d..d253b0c 100644 --- a/absl/log/internal/log_message.cc +++ b/absl/log/internal/log_message.cc
@@ -279,8 +279,8 @@ : LogMessage(absl::string_view(file), line, severity) {} LogMessage::LogMessage(absl::string_view file, int line, absl::LogSeverity severity) - : data_(absl::make_unique<LogMessageData>(file, line, severity, - absl::Now())) { + : data_( + std::make_unique<LogMessageData>(file, line, severity, absl::Now())) { data_->first_fatal = false; data_->is_perror = false; data_->fail_quietly = false;
diff --git a/absl/log/internal/structured_proto_test.cc b/absl/log/internal/structured_proto_test.cc index a4deebc..7a1b82c 100644 --- a/absl/log/internal/structured_proto_test.cc +++ b/absl/log/internal/structured_proto_test.cc
@@ -71,7 +71,7 @@ { 42, StructuredProtoField::Value{ - absl::in_place_type<StructuredProtoField::Varint>, + std::in_place_type<StructuredProtoField::Varint>, int32_t{23}, }, }, @@ -82,7 +82,7 @@ { 42, StructuredProtoField::Value{ - absl::in_place_type<StructuredProtoField::I64>, + std::in_place_type<StructuredProtoField::I64>, int64_t{23}, }, }, @@ -103,7 +103,7 @@ { 42, StructuredProtoField::Value{ - absl::in_place_type<StructuredProtoField::I32>, + std::in_place_type<StructuredProtoField::I32>, int32_t{23}, }, },
diff --git a/absl/log/internal/vlog_config_benchmark.cc b/absl/log/internal/vlog_config_benchmark.cc index 9004e2e..9438324 100644 --- a/absl/log/internal/vlog_config_benchmark.cc +++ b/absl/log/internal/vlog_config_benchmark.cc
@@ -45,7 +45,7 @@ const size_t max_sites_per_tu, const int num_shuffles) { per_tu_data_.reserve(num_tus); - auto sites = absl::make_unique<VLogSite *[]>(num_tus * max_sites_per_tu); + auto sites = std::make_unique<VLogSite*[]>(num_tus * max_sites_per_tu); for (size_t i = 0; i < num_tus; i++) { const std::string filename = absl::StrCat("directory-", i / 100, "/subdirectory-", i % 100 / 10, @@ -55,7 +55,7 @@ absl::LogUniform<size_t>(bitgen_, 1, max_sites_per_tu), absl::LogUniform<size_t>(bitgen_, 0, max_extra_static_data_bytes_per_tu)); - auto buf = absl::make_unique<char[]>(layout.AllocSize()); + auto buf = std::make_unique<char[]>(layout.AllocSize()); layout.PoisonPadding(buf.get()); memcpy(layout.Pointer<0>(buf.get()), filename.c_str(), filename.size() + 1); @@ -78,7 +78,7 @@ std::memory_order_seq_cst); } // Now do some shufflin'. - auto new_sites = absl::make_unique<VLogSite *[]>(num_sites_); + auto new_sites = std::make_unique<VLogSite*[]>(num_sites_); for (int shuffle_num = 0; shuffle_num < num_shuffles; shuffle_num++) { // Each shuffle cuts the ring into three pieces and rearranges them. const size_t cut_a = absl::Uniform(bitgen_, size_t{0}, num_sites_);
diff --git a/absl/log/log_streamer.h b/absl/log/log_streamer.h index 213e352..294012b 100644 --- a/absl/log/log_streamer.h +++ b/absl/log/log_streamer.h
@@ -84,7 +84,7 @@ : severity_(severity), line_(line), file_(file), - stream_(absl::in_place, &buf_) { + stream_(std::in_place, &buf_) { // To match `LOG`'s defaults: stream_->setf(std::ios_base::showbase | std::ios_base::boolalpha); }
diff --git a/absl/log/scoped_mock_log_test.cc b/absl/log/scoped_mock_log_test.cc index 4273693..fd7c10b 100644 --- a/absl/log/scoped_mock_log_test.cc +++ b/absl/log/scoped_mock_log_test.cc
@@ -261,7 +261,7 @@ TEST(ScopedMockLogTsanTest, ScopedMockLogCanBeDeletedWhenAnotherThreadIsLogging) { - auto log = absl::make_unique<absl::ScopedMockLog>(); + auto log = std::make_unique<absl::ScopedMockLog>(); EXPECT_CALL(*log, Log(absl::LogSeverity::kInfo, __FILE__, "Thread log")) .Times(AnyNumber());
diff --git a/absl/memory/memory.h b/absl/memory/memory.h index 2c897f8..9958215 100644 --- a/absl/memory/memory.h +++ b/absl/memory/memory.h
@@ -58,7 +58,7 @@ // std::unique_ptr<X> x(NewX(1, 2)); // // While `absl::WrapUnique` is useful for capturing the output of a raw -// pointer factory, prefer 'absl::make_unique<T>(args...)' over +// pointer factory, prefer 'std::make_unique<T>(args...)' over // 'absl::WrapUnique(new T(args...))'. // // auto x = WrapUnique(new X(1, 2)); // works, but nonideal. @@ -117,7 +117,7 @@ // These are make_unique_for_overwrite variants modeled after // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1973r1.pdf -// Unlike absl::make_unique, values are default initialized rather than value +// Unlike std::make_unique, values are default initialized rather than value // initialized. // // `absl::make_unique_for_overwrite` overload for non-array types. @@ -167,7 +167,7 @@ // // Example: // -// auto up = absl::make_unique<int>(10); +// auto up = std::make_unique<int>(10); // auto sp = absl::ShareUniquePtr(std::move(up)); // shared_ptr<int> // CHECK_EQ(*sp, 10); // CHECK(up == nullptr);
diff --git a/absl/memory/memory_test.cc b/absl/memory/memory_test.cc index aeb6001..935b424 100644 --- a/absl/memory/memory_test.cc +++ b/absl/memory/memory_test.cc
@@ -195,7 +195,7 @@ } TEST(ShareUniquePtrTest, Share) { - auto up = absl::make_unique<int>(); + auto up = std::make_unique<int>(); int* rp = up.get(); auto sp = absl::ShareUniquePtr(std::move(up)); EXPECT_EQ(sp.get(), rp);
diff --git a/absl/random/discrete_distribution.h b/absl/random/discrete_distribution.h index f579a64..854634d 100644 --- a/absl/random/discrete_distribution.h +++ b/absl/random/discrete_distribution.h
@@ -38,7 +38,7 @@ // A discrete distribution produces random integers i, where 0 <= i < n // distributed according to the discrete probability function: // -// P(i|p0,...,pn−1)=pi +// P(i|p0,...,pn-1)=pi // // This class is an implementation of discrete_distribution (see // [rand.dist.samp.discrete]).
diff --git a/absl/random/internal/distribution_caller.h b/absl/random/internal/distribution_caller.h index d14fa85..1416aba 100644 --- a/absl/random/internal/distribution_caller.h +++ b/absl/random/internal/distribution_caller.h
@@ -62,7 +62,7 @@ ResultT result; if (!RandomMockingAccess::InvokeMock<URBG>(urbg, FastTypeId<KeyT>(), &arg_tuple, &result)) { - auto dist = absl::make_from_tuple<DistrT>(arg_tuple); + auto dist = std::make_from_tuple<DistrT>(arg_tuple); result = dist(*urbg); } return result;
diff --git a/absl/random/internal/salted_seed_seq.h b/absl/random/internal/salted_seed_seq.h index a86c39d..b440717 100644 --- a/absl/random/internal/salted_seed_seq.h +++ b/absl/random/internal/salted_seed_seq.h
@@ -49,11 +49,11 @@ using inner_sequence_type = SSeq; using result_type = typename SSeq::result_type; - SaltedSeedSeq() : seq_(absl::make_unique<SSeq>()) {} + SaltedSeedSeq() : seq_(std::make_unique<SSeq>()) {} template <typename Iterator> SaltedSeedSeq(Iterator begin, Iterator end) - : seq_(absl::make_unique<SSeq>(begin, end)) {} + : seq_(std::make_unique<SSeq>(begin, end)) {} template <typename T> SaltedSeedSeq(std::initializer_list<T> il)
diff --git a/absl/random/mocking_bit_gen.h b/absl/random/mocking_bit_gen.h index 74aa17d..6117e7c 100644 --- a/absl/random/mocking_bit_gen.h +++ b/absl/random/mocking_bit_gen.h
@@ -106,7 +106,7 @@ static auto GetMockFnType(ResultT, std::tuple<Args...>) -> ::testing::MockFunction<ResultT(Args...)>; - // MockFnCaller is a helper method for use with absl::apply to + // MockFnCaller is a helper method for use with std::apply to // apply an ArgTupleT to a compatible MockFunction. // NOTE: MockFnCaller is essentially equivalent to the lambda: // [fn](auto... args) { return fn->Call(std::move(args)...)} @@ -148,7 +148,7 @@ // Requires tuple_args to point to a ArgTupleT, which is a // std::tuple<Args...> used to invoke the mock function. Requires result // to point to a ResultT, which is the result of the call. - *static_cast<ResultT*>(result) = absl::apply( + *static_cast<ResultT*>(result) = std::apply( MockFnCaller<MockFnType, ValidatorT, ResultT, ArgTupleT>{&mock_fn_}, *static_cast<ArgTupleT*>(args_tuple)); } @@ -189,7 +189,7 @@ FunctionHolderImpl<WrappedFnType, ValidatorT, ResultT, ArgTupleT>; auto& mock = mocks_[type]; if (!mock) { - mock = absl::make_unique<ImplT>(); + mock = std::make_unique<ImplT>(); } return static_cast<ImplT*>(mock.get())->mock_fn_; }
diff --git a/absl/status/internal/status_internal.cc b/absl/status/internal/status_internal.cc index 6e79234..1397de7 100644 --- a/absl/status/internal/status_internal.cc +++ b/absl/status/internal/status_internal.cc
@@ -81,7 +81,7 @@ void StatusRep::SetPayload(absl::string_view type_url, absl::Cord payload) { if (payloads_ == nullptr) { - payloads_ = absl::make_unique<status_internal::Payloads>(); + payloads_ = std::make_unique<status_internal::Payloads>(); } std::optional<size_t> index = @@ -223,7 +223,7 @@ } std::unique_ptr<status_internal::Payloads> payloads; if (payloads_) { - payloads = absl::make_unique<status_internal::Payloads>(*payloads_); + payloads = std::make_unique<status_internal::Payloads>(*payloads_); } auto* new_rep = new StatusRep(code_, message_, std::move(payloads)); new_rep->source_locations_ = source_locations_;
diff --git a/absl/status/internal/statusor_internal.h b/absl/status/internal/statusor_internal.h index ccfdedb..de56519 100644 --- a/absl/status/internal/statusor_internal.h +++ b/absl/status/internal/statusor_internal.h
@@ -117,7 +117,7 @@ std::negation<std::disjunction< std::is_same<absl::StatusOr<T>, absl::remove_cvref_t<U>>, std::is_same<absl::Status, absl::remove_cvref_t<U>>, - std::is_same<absl::in_place_t, absl::remove_cvref_t<U>>, + std::is_same<std::in_place_t, absl::remove_cvref_t<U>>, IsDirectInitializationAmbiguous<T, U>>>>>; // This trait detects whether `StatusOr<T>::operator=(U&&)` is ambiguous, which @@ -149,7 +149,7 @@ std::negation<std::disjunction< std::is_same<absl::StatusOr<T>, absl::remove_cvref_t<U>>, std::is_same<absl::Status, absl::remove_cvref_t<U>>, - std::is_same<absl::in_place_t, absl::remove_cvref_t<U>>, + std::is_same<std::in_place_t, absl::remove_cvref_t<U>>, IsForwardingAssignmentAmbiguous<T, U>>>>; template <bool Value, typename T> @@ -194,7 +194,7 @@ using IsConstructionFromStatusValid = std::conjunction< std::negation<std::is_same<absl::StatusOr<T>, absl::remove_cvref_t<U>>>, std::negation<std::is_same<T, absl::remove_cvref_t<U>>>, - std::negation<std::is_same<absl::in_place_t, absl::remove_cvref_t<U>>>, + std::negation<std::is_same<std::in_place_t, absl::remove_cvref_t<U>>>, Equality<!Explicit, std::is_convertible<U, absl::Status>>, std::is_constructible<absl::Status, U>, std::negation<HasConversionOperatorToStatusOr<T, U>>>; @@ -325,7 +325,7 @@ } template <typename... Args> - explicit StatusOrData(absl::in_place_t, Args&&... args) + explicit StatusOrData(std::in_place_t, Args&&... args) : data_(std::forward<Args>(args)...) { MakeStatus(); }
diff --git a/absl/status/statusor.h b/absl/status/statusor.h index 0af1d75..eedd99f 100644 --- a/absl/status/statusor.h +++ b/absl/status/statusor.h
@@ -416,9 +416,9 @@ // Constructs the inner value `T` in-place using the provided args, using the // `T(args...)` constructor. template <typename... Args> - explicit StatusOr(absl::in_place_t, Args&&... args); + explicit StatusOr(std::in_place_t, Args&&... args); template <typename U, typename... Args> - explicit StatusOr(absl::in_place_t, std::initializer_list<U> ilist, + explicit StatusOr(std::in_place_t, std::initializer_list<U> ilist, Args&&... args); // Constructs the inner value `T` in-place using the provided args, using the @@ -430,29 +430,29 @@ // `J` is convertible to `T`. template <typename U = T, std::enable_if_t<internal_statusor::IsConstructionValid< - false, T, U, false>::value, - int> = 0> + false, T, U, false>::value, + int> = 0> StatusOr(U&& u) // NOLINT - : StatusOr(absl::in_place, std::forward<U>(u)) {} + : StatusOr(std::in_place, std::forward<U>(u)) {} template <typename U = T, std::enable_if_t<internal_statusor::IsConstructionValid< - false, T, U, true>::value, - int> = 0> + false, T, U, true>::value, + int> = 0> StatusOr(U&& u ABSL_ATTRIBUTE_LIFETIME_BOUND) // NOLINT - : StatusOr(absl::in_place, std::forward<U>(u)) {} + : StatusOr(std::in_place, std::forward<U>(u)) {} template <typename U = T, std::enable_if_t<internal_statusor::IsConstructionValid< - true, T, U, false>::value, - int> = 0> + true, T, U, false>::value, + int> = 0> explicit StatusOr(U&& u) // NOLINT - : StatusOr(absl::in_place, std::forward<U>(u)) {} + : StatusOr(std::in_place, std::forward<U>(u)) {} template <typename U = T, std::enable_if_t< internal_statusor::IsConstructionValid<true, T, U, true>::value, int> = 0> explicit StatusOr(U&& u ABSL_ATTRIBUTE_LIFETIME_BOUND) // NOLINT - : StatusOr(absl::in_place, std::forward<U>(u)) {} + : StatusOr(std::in_place, std::forward<U>(u)) {} // StatusOr<T>::ok() // @@ -747,14 +747,14 @@ } template <typename T> template <typename... Args> -StatusOr<T>::StatusOr(absl::in_place_t, Args&&... args) - : Base(absl::in_place, std::forward<Args>(args)...) {} +StatusOr<T>::StatusOr(std::in_place_t, Args&&... args) + : Base(std::in_place, std::forward<Args>(args)...) {} template <typename T> template <typename U, typename... Args> -StatusOr<T>::StatusOr(absl::in_place_t, std::initializer_list<U> ilist, +StatusOr<T>::StatusOr(std::in_place_t, std::initializer_list<U> ilist, Args&&... args) - : Base(absl::in_place, ilist, std::forward<Args>(args)...) {} + : Base(std::in_place, ilist, std::forward<Args>(args)...) {} template <typename T> const Status& StatusOr<T>::status() const& {
diff --git a/absl/status/statusor_test.cc b/absl/status/statusor_test.cc index bd2c10e..fc558f6 100644 --- a/absl/status/statusor_test.cc +++ b/absl/status/statusor_test.cc
@@ -115,7 +115,7 @@ absl::StatusOr<std::unique_ptr<int>> ReturnUniquePtr() { // Uses implicit constructor from T&& - return absl::make_unique<int>(0); + return std::make_unique<int>(0); } TEST(StatusOr, ElementType) { @@ -358,7 +358,7 @@ }; TEST(StatusOr, InPlaceConstruction) { - EXPECT_THAT(absl::StatusOr<Foo>(absl::in_place, 10), + EXPECT_THAT(absl::StatusOr<Foo>(std::in_place, 10), IsOkAndHolds(Field(&Foo::x, 10))); } @@ -370,8 +370,8 @@ }; TEST(StatusOr, InPlaceInitListConstruction) { - absl::StatusOr<InPlaceHelper> status_or(absl::in_place, {10, 11, 12}, - absl::make_unique<int>(13)); + absl::StatusOr<InPlaceHelper> status_or(std::in_place, {10, 11, 12}, + std::make_unique<int>(13)); EXPECT_THAT(status_or, IsOkAndHolds(AllOf( Field(&InPlaceHelper::x, ElementsAre(10, 11, 12)), Field(&InPlaceHelper::y, Pointee(13))))); @@ -390,9 +390,9 @@ } TEST(StatusOr, EmplaceInitializerList) { - absl::StatusOr<InPlaceHelper> status_or(absl::in_place, {10, 11, 12}, - absl::make_unique<int>(13)); - status_or.emplace({1, 2, 3}, absl::make_unique<int>(4)); + absl::StatusOr<InPlaceHelper> status_or(std::in_place, {10, 11, 12}, + std::make_unique<int>(13)); + status_or.emplace({1, 2, 3}, std::make_unique<int>(4)); EXPECT_THAT(status_or, IsOkAndHolds(AllOf(Field(&InPlaceHelper::x, ElementsAre(1, 2, 3)), Field(&InPlaceHelper::y, Pointee(4))))); @@ -400,7 +400,7 @@ EXPECT_FALSE(status_or.ok()); EXPECT_EQ(status_or.status().code(), absl::StatusCode::kInvalidArgument); EXPECT_EQ(status_or.status().message(), "msg"); - status_or.emplace({1, 2, 3}, absl::make_unique<int>(4)); + status_or.emplace({1, 2, 3}, std::make_unique<int>(4)); EXPECT_THAT(status_or, IsOkAndHolds(AllOf(Field(&InPlaceHelper::x, ElementsAre(1, 2, 3)), Field(&InPlaceHelper::y, Pointee(4))))); @@ -711,7 +711,7 @@ TEST(StatusOr, UniquePtrImplicitConstruction) { auto status_or = absl::implicit_cast<absl::StatusOr<std::unique_ptr<Base1>>>( - absl::make_unique<Derived>()); + std::make_unique<Derived>()); EXPECT_THAT(status_or, IsOkAndHolds(Ne(nullptr))); } @@ -903,7 +903,7 @@ TEST(StatusOr, UniquePtrImplicitAssignment) { absl::StatusOr<std::unique_ptr<Base1>> status_or; - status_or = absl::make_unique<Derived>(); + status_or = std::make_unique<Derived>(); EXPECT_THAT(status_or, IsOkAndHolds(Ne(nullptr))); } @@ -1398,14 +1398,14 @@ } TEST(StatusOr, MoveOnlyValueOrOk) { - EXPECT_THAT(absl::StatusOr<std::unique_ptr<int>>(absl::make_unique<int>(0)) - .value_or(absl::make_unique<int>(-1)), + EXPECT_THAT(absl::StatusOr<std::unique_ptr<int>>(std::make_unique<int>(0)) + .value_or(std::make_unique<int>(-1)), Pointee(0)); } TEST(StatusOr, MoveOnlyValueOrDefault) { EXPECT_THAT(absl::StatusOr<std::unique_ptr<int>>(absl::CancelledError()) - .value_or(absl::make_unique<int>(-1)), + .value_or(std::make_unique<int>(-1)), Pointee(-1)); }
diff --git a/absl/strings/internal/cordz_sample_token_test.cc b/absl/strings/internal/cordz_sample_token_test.cc index 7152603..487396b 100644 --- a/absl/strings/internal/cordz_sample_token_test.cc +++ b/absl/strings/internal/cordz_sample_token_test.cc
@@ -187,7 +187,7 @@ } } else { // 5) Sample - token = absl::make_unique<CordzSampleToken>(); + token = std::make_unique<CordzSampleToken>(); } } }
diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h index 120bc35..075a9d5 100644 --- a/absl/strings/internal/str_format/bind.h +++ b/absl/strings/internal/str_format/bind.h
@@ -116,7 +116,7 @@ } template <FormatConversionCharSet... C, size_t... I> - static bool CheckMatches(absl::index_sequence<I...>) { + static bool CheckMatches(std::index_sequence<I...>) { bool res[] = {true, CheckMatch<Args, C, I + 1>()...}; (void)res; return true; @@ -173,7 +173,7 @@ FormatSpecTemplate(const ExtendedParsedFormat<C...>& pc) // NOLINT : Base(&pc) { CheckArity<sizeof...(C), sizeof...(Args)>(); - CheckMatches<C...>(absl::make_index_sequence<sizeof...(C)>{}); + CheckMatches<C...>(std::make_index_sequence<sizeof...(C)>{}); } };
diff --git a/absl/strings/str_join_test.cc b/absl/strings/str_join_test.cc index cd52e11..1c0ffe1 100644 --- a/absl/strings/str_join_test.cc +++ b/absl/strings/str_join_test.cc
@@ -501,12 +501,12 @@ absl::StrJoin(std::make_tuple(&x, &y, &z), "-", absl::DereferenceFormatter(TestFormatter()))); EXPECT_EQ("0x0000000a-hell-3.", - absl::StrJoin(std::make_tuple(absl::make_unique<int>(x), - absl::make_unique<std::string>(y), - absl::make_unique<double>(z)), + absl::StrJoin(std::make_tuple(std::make_unique<int>(x), + std::make_unique<std::string>(y), + std::make_unique<double>(z)), "-", absl::DereferenceFormatter(TestFormatter()))); EXPECT_EQ("0x0000000a-hell-3.", - absl::StrJoin(std::make_tuple(absl::make_unique<int>(x), &y, &z), + absl::StrJoin(std::make_tuple(std::make_unique<int>(x), &y, &z), "-", absl::DereferenceFormatter(TestFormatter()))); }
diff --git a/absl/strings/str_split.h b/absl/strings/str_split.h index 29fa4f7..e9b7378 100644 --- a/absl/strings/str_split.h +++ b/absl/strings/str_split.h
@@ -390,7 +390,7 @@ template <typename T> using EnableSplitIfString = typename std::enable_if<std::is_same<T, std::string>::value || - std::is_same<T, const std::string>::value, + std::is_same<T, const std::string>::value, int>::type; //------------------------------------------------------------------------------ @@ -399,11 +399,16 @@ // StrSplit() // -// Splits a given string based on the provided `Delimiter` object, returning the -// elements within the type specified by the caller. Optionally, you may pass a -// `Predicate` to `StrSplit()` indicating whether to include or exclude the -// resulting element within the final result set. (See the overviews for -// Delimiters and Predicates above.) +// Splits a string into a sequence of substrings identified by `Delimiter`. The +// input is processed sequentially from beginning to end, and each resulting +// substring is filtered by an optional `Predicate` before inclusion in the +// result set. `StrSplit()` returns a lazy range that preserves the substrings +// original order and is convertible to the collection type specified by the +// caller. +// +// Optionally, you may pass a `Predicate` to `StrSplit()` indicating whether to +// include or exclude the resulting element within the final result set. (See +// the overviews for Delimiters and Predicates above.) // // Example: //
diff --git a/absl/synchronization/mutex_test.cc b/absl/synchronization/mutex_test.cc index 38c8691..7b13eec 100644 --- a/absl/synchronization/mutex_test.cc +++ b/absl/synchronization/mutex_test.cc
@@ -56,7 +56,7 @@ std::unique_ptr<absl::synchronization_internal::ThreadPool> CreatePool( int threads) { - return absl::make_unique<absl::synchronization_internal::ThreadPool>(threads); + return std::make_unique<absl::synchronization_internal::ThreadPool>(threads); } std::unique_ptr<absl::synchronization_internal::ThreadPool> @@ -868,7 +868,7 @@ for (int i = 0; i != 10; i++) { // Create, lock and destroy 10 locks. const int kNumLocks = 10; - auto mu = absl::make_unique<absl::Mutex[]>(kNumLocks); + auto mu = std::make_unique<absl::Mutex[]>(kNumLocks); for (int j = 0; j != kNumLocks; j++) { if ((j % 2) == 0) { mu[j].lock(); @@ -1306,7 +1306,7 @@ // If a deadlock detector keeps a full graph of lock acquisition order, // it will likely be too slow for this test to pass. const int n_locks = 1 << 17; - auto array_of_locks = absl::make_unique<absl::Mutex[]>(n_locks); + auto array_of_locks = std::make_unique<absl::Mutex[]>(n_locks); for (int i = 0; i < n_locks; i++) { int end = std::min(n_locks, i + 5); // acquire and then release locks i, i+1, ..., i+4
diff --git a/absl/time/internal/cctz/testdata/version b/absl/time/internal/cctz/testdata/version index 5d91260..75d34ee 100644 --- a/absl/time/internal/cctz/testdata/version +++ b/absl/time/internal/cctz/testdata/version
@@ -1 +1 @@ -2026a +2026b
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/America/Vancouver b/absl/time/internal/cctz/testdata/zoneinfo/America/Vancouver index c998491..1ab2eaf 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/America/Vancouver +++ b/absl/time/internal/cctz/testdata/zoneinfo/America/Vancouver Binary files differ
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Ho_Chi_Minh b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Ho_Chi_Minh index 86e21b0..294796a 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Ho_Chi_Minh +++ b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Ho_Chi_Minh Binary files differ
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Phnom_Penh b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Phnom_Penh index c49800e..2053499 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Phnom_Penh +++ b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Phnom_Penh Binary files differ
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Saigon b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Saigon index 86e21b0..294796a 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Saigon +++ b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Saigon Binary files differ
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Vientiane b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Vientiane index 659e511..78ea66f 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/Asia/Vientiane +++ b/absl/time/internal/cctz/testdata/zoneinfo/Asia/Vientiane Binary files differ
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/Canada/Pacific b/absl/time/internal/cctz/testdata/zoneinfo/Canada/Pacific index c998491..1ab2eaf 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/Canada/Pacific +++ b/absl/time/internal/cctz/testdata/zoneinfo/Canada/Pacific Binary files differ
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab b/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab index cd43e3d..a9b47bc 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab +++ b/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab
@@ -115,11 +115,11 @@ CA +5333-11328 America/Edmonton Mountain - AB, BC(E), NT(E), SK(W) CA +690650-1050310 America/Cambridge_Bay Mountain - NU (west) CA +682059-1334300 America/Inuvik Mountain - NT (west) +CA +4916-12307 America/Vancouver MST - BC (most areas) CA +5546-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John) CA +5848-12242 America/Fort_Nelson MST - BC (Ft Nelson) CA +6043-13503 America/Whitehorse MST - Yukon (east) CA +6404-13925 America/Dawson MST - Yukon (west) -CA +4916-12307 America/Vancouver Pacific - BC (most areas) CH,DE,LI +4723+00832 Europe/Zurich Büsingen CI,BF,GH,GM,GN,IS,ML,MR,SH,SL,SN,TG +0519-00402 Africa/Abidjan CK -2114-15946 Pacific/Rarotonga
diff --git a/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab b/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab index aa3a64f..54e4485 100644 --- a/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab +++ b/absl/time/internal/cctz/testdata/zoneinfo/zonenow.tab
@@ -58,6 +58,9 @@ # -08/-07 - PST/PDT (North America DST) XX +340308-1181434 America/Los_Angeles Pacific (PST/PDT) - US & Canada; Mexico near US border # +# -08/-07 - PST/PDT (North America DST) until 2026-11-01 02:00; then MST +XX +4916-12307 America/Vancouver MST - BC (most areas) +# # -07 - MST XX +332654-1120424 America/Phoenix Mountain Standard (MST) - Arizona; western Mexico; Yukon #
diff --git a/absl/types/variant.h b/absl/types/variant.h index 6b36645..4c50bbe 100644 --- a/absl/types/variant.h +++ b/absl/types/variant.h
@@ -16,9 +16,9 @@ // variant.h // ----------------------------------------------------------------------------- // -// Historical note: Abseil once provided an implementation of `absl::variant` +// Historical note: Abseil once provided an implementation of `std::variant` // as a polyfill for `std::variant` prior to C++17. Now that C++17 is required, -// `absl::variant` is an alias for `std::variant`. +// `std::variant` is an alias for `std::variant`. #ifndef ABSL_TYPES_VARIANT_H_ #define ABSL_TYPES_VARIANT_H_ @@ -57,23 +57,23 @@ // ConvertVariantTo() // -// Helper functions to convert an `absl::variant` to a variant of another set of +// Helper functions to convert an `std::variant` to a variant of another set of // types, provided that the alternative type of the new variant type can be // converted from any type in the source variant. // // Example: // -// absl::variant<name1, name2, float> InternalReq(const Req&); +// std::variant<name1, name2, float> InternalReq(const Req&); // // // name1 and name2 are convertible to name -// absl::variant<name, float> ExternalReq(const Req& req) { -// return absl::ConvertVariantTo<absl::variant<name, float>>( +// std::variant<name, float> ExternalReq(const Req& req) { +// return absl::ConvertVariantTo<std::variant<name, float>>( // InternalReq(req)); // } template <typename To, typename Variant> To ConvertVariantTo(Variant&& variant) { - return absl::visit(variant_internal::ConversionVisitor<To>{}, - std::forward<Variant>(variant)); + return std::visit(variant_internal::ConversionVisitor<To>{}, + std::forward<Variant>(variant)); } ABSL_NAMESPACE_END
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc index 4d7b025..edf51e5 100644 --- a/absl/types/variant_test.cc +++ b/absl/types/variant_test.cc
@@ -51,22 +51,22 @@ std::variant<Convertible1, Convertible2> v( ConvertVariantTo<std::variant<Convertible1, Convertible2>>( (std::variant<Convertible2, Convertible1>(Convertible1())))); - ASSERT_TRUE(absl::holds_alternative<Convertible1>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible1>(v)); v = ConvertVariantTo<std::variant<Convertible1, Convertible2>>( std::variant<Convertible2, Convertible1>(Convertible2())); - ASSERT_TRUE(absl::holds_alternative<Convertible2>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible2>(v)); } TEST(VariantTest, TestLvalueConversion) { std::variant<Convertible2, Convertible1> source((Convertible1())); std::variant<Convertible1, Convertible2> v( ConvertVariantTo<std::variant<Convertible1, Convertible2>>(source)); - ASSERT_TRUE(absl::holds_alternative<Convertible1>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible1>(v)); source = Convertible2(); v = ConvertVariantTo<std::variant<Convertible1, Convertible2>>(source); - ASSERT_TRUE(absl::holds_alternative<Convertible2>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible2>(v)); } TEST(VariantTest, TestMoveConversion) { @@ -77,14 +77,14 @@ Variant var( ConvertVariantTo<Variant>(OtherVariant{std::make_unique<int>(0)})); - ASSERT_TRUE(absl::holds_alternative<std::unique_ptr<const int>>(var)); - ASSERT_NE(absl::get<std::unique_ptr<const int>>(var), nullptr); - EXPECT_EQ(0, *absl::get<std::unique_ptr<const int>>(var)); + ASSERT_TRUE(std::holds_alternative<std::unique_ptr<const int>>(var)); + ASSERT_NE(std::get<std::unique_ptr<const int>>(var), nullptr); + EXPECT_EQ(0, *std::get<std::unique_ptr<const int>>(var)); var = ConvertVariantTo<Variant>( OtherVariant(std::make_unique<std::string>("foo"))); - ASSERT_TRUE(absl::holds_alternative<std::unique_ptr<const std::string>>(var)); - EXPECT_EQ("foo", *absl::get<std::unique_ptr<const std::string>>(var)); + ASSERT_TRUE(std::holds_alternative<std::unique_ptr<const std::string>>(var)); + EXPECT_EQ("foo", *std::get<std::unique_ptr<const std::string>>(var)); } TEST(VariantTest, DoesNotMoveFromLvalues) { @@ -100,47 +100,47 @@ // Test copy constructor Variant v2(v1); - EXPECT_EQ(absl::get<std::shared_ptr<const int>>(v1), - absl::get<std::shared_ptr<const int>>(v2)); + EXPECT_EQ(std::get<std::shared_ptr<const int>>(v1), + std::get<std::shared_ptr<const int>>(v2)); // Test copy-assignment operator v1 = std::make_shared<const std::string>("foo"); v2 = v1; - EXPECT_EQ(absl::get<std::shared_ptr<const std::string>>(v1), - absl::get<std::shared_ptr<const std::string>>(v2)); + EXPECT_EQ(std::get<std::shared_ptr<const std::string>>(v1), + std::get<std::shared_ptr<const std::string>>(v2)); // Test converting copy constructor OtherVariant other(std::make_shared<int>(0)); Variant v3(ConvertVariantTo<Variant>(other)); - EXPECT_EQ(absl::get<std::shared_ptr<int>>(other), - absl::get<std::shared_ptr<const int>>(v3)); + EXPECT_EQ(std::get<std::shared_ptr<int>>(other), + std::get<std::shared_ptr<const int>>(v3)); other = std::make_shared<std::string>("foo"); v3 = ConvertVariantTo<Variant>(other); - EXPECT_EQ(absl::get<std::shared_ptr<std::string>>(other), - absl::get<std::shared_ptr<const std::string>>(v3)); + EXPECT_EQ(std::get<std::shared_ptr<std::string>>(other), + std::get<std::shared_ptr<const std::string>>(v3)); } TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) { variant<Convertible1, Convertible2> v( ConvertVariantTo<std::variant<Convertible1, Convertible2>>( (std::variant<Convertible2, Convertible1>(Convertible1())))); - ASSERT_TRUE(absl::holds_alternative<Convertible1>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible1>(v)); v = ConvertVariantTo<std::variant<Convertible1, Convertible2>>( std::variant<Convertible2, Convertible1>(Convertible2())); - ASSERT_TRUE(absl::holds_alternative<Convertible2>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible2>(v)); } TEST(VariantTest, TestLvalueConversionViaConvertVariantTo) { variant<Convertible2, Convertible1> source((Convertible1())); variant<Convertible1, Convertible2> v( ConvertVariantTo<std::variant<Convertible1, Convertible2>>(source)); - ASSERT_TRUE(absl::holds_alternative<Convertible1>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible1>(v)); source = Convertible2(); v = ConvertVariantTo<std::variant<Convertible1, Convertible2>>(source); - ASSERT_TRUE(absl::holds_alternative<Convertible2>(v)); + ASSERT_TRUE(std::holds_alternative<Convertible2>(v)); } TEST(VariantTest, TestMoveConversionViaConvertVariantTo) { @@ -151,12 +151,12 @@ Variant var( ConvertVariantTo<Variant>(OtherVariant{std::make_unique<int>(3)})); - EXPECT_THAT(absl::get_if<std::unique_ptr<const int>>(&var), + EXPECT_THAT(std::get_if<std::unique_ptr<const int>>(&var), Pointee(Pointee(3))); var = ConvertVariantTo<Variant>( OtherVariant(std::make_unique<std::string>("foo"))); - EXPECT_THAT(absl::get_if<std::unique_ptr<const std::string>>(&var), + EXPECT_THAT(std::get_if<std::unique_ptr<const std::string>>(&var), Pointee(Pointee(std::string("foo")))); }