diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h index 3636f8e7..a823ee15 100644 --- a/absl/algorithm/container.h +++ b/absl/algorithm/container.h @@ -819,8 +819,8 @@ template > 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 347b41fd..8a898be8 100644 --- a/absl/algorithm/container_test.cc +++ b/absl/algorithm/container_test.cc @@ -729,11 +729,11 @@ TEST(MutatingTest, CopyBackward) { TEST(MutatingTest, Move) { std::vector> src; - src.emplace_back(absl::make_unique(1)); - src.emplace_back(absl::make_unique(2)); - src.emplace_back(absl::make_unique(3)); - src.emplace_back(absl::make_unique(4)); - src.emplace_back(absl::make_unique(5)); + src.emplace_back(std::make_unique(1)); + src.emplace_back(std::make_unique(2)); + src.emplace_back(std::make_unique(3)); + src.emplace_back(std::make_unique(4)); + src.emplace_back(std::make_unique(5)); std::vector> dest = {}; absl::c_move(src, std::back_inserter(dest)); @@ -744,11 +744,11 @@ TEST(MutatingTest, Move) { TEST(MutatingTest, MoveBackward) { std::vector> actual; - actual.emplace_back(absl::make_unique(1)); - actual.emplace_back(absl::make_unique(2)); - actual.emplace_back(absl::make_unique(3)); - actual.emplace_back(absl::make_unique(4)); - actual.emplace_back(absl::make_unique(5)); + actual.emplace_back(std::make_unique(1)); + actual.emplace_back(std::make_unique(2)); + actual.emplace_back(std::make_unique(3)); + actual.emplace_back(std::make_unique(4)); + actual.emplace_back(std::make_unique(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, MoveBackward) { TEST(MutatingTest, MoveWithRvalue) { auto MakeRValueSrc = [] { std::vector> src; - src.emplace_back(absl::make_unique(1)); - src.emplace_back(absl::make_unique(2)); - src.emplace_back(absl::make_unique(3)); + src.emplace_back(std::make_unique(1)); + src.emplace_back(std::make_unique(2)); + src.emplace_back(std::make_unique(3)); return src; }; diff --git a/absl/base/exception_safety_testing_test.cc b/absl/base/exception_safety_testing_test.cc index a0b6f9a8..d615a38e 100644 --- a/absl/base/exception_safety_testing_test.cc +++ b/absl/base/exception_safety_testing_test.cc @@ -236,8 +236,8 @@ void TestAllocatingOp(const F& f) { TEST(ThrowingValueTest, ThrowingAllocatingOps) { // make_unique calls unqualified operator new, so these exercise the // ThrowingValue overloads. - TestAllocatingOp([]() { return absl::make_unique>(1); }); - TestAllocatingOp([]() { return absl::make_unique[]>(2); }); + TestAllocatingOp([]() { return std::make_unique>(1); }); + TestAllocatingOp([]() { return std::make_unique[]>(2); }); } TEST(ThrowingValueTest, NonThrowingMoveCtor) { @@ -546,7 +546,7 @@ TEST(ExceptionSafetyTesterTest, IncompleteTypesAreNotTestable) { using T = exceptions_internal::UninitializedT; auto op = [](T* t) {}; auto inv = [](T*) { return testing::AssertionSuccess(); }; - auto fac = []() { return absl::make_unique(); }; + auto fac = []() { return std::make_unique(); }; // 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 @@ TEST(ExceptionSafetyTesterTest, IncompleteTypesAreNotTestable) { struct ExampleStruct {}; std::unique_ptr ExampleFunctionFactory() { - return absl::make_unique(); + return std::make_unique(); } void ExampleFunctionOperation(ExampleStruct*) {} @@ -792,7 +792,7 @@ struct NonCopyable : public NonNegative { }; TEST(ExceptionCheckTest, NonCopyable) { - auto factory = []() { return absl::make_unique(); }; + auto factory = []() { return std::make_unique(); }; 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 29f934f8..a2d128e1 100644 --- a/absl/base/internal/exception_safety_testing.h +++ b/absl/base/internal/exception_safety_testing.h @@ -837,7 +837,7 @@ template class DefaultFactory { public: explicit DefaultFactory(const T& t) : t_(t) {} - std::unique_ptr operator()() const { return absl::make_unique(t_); } + std::unique_ptr operator()() const { return std::make_unique(t_); } private: T t_; @@ -1056,7 +1056,7 @@ class ExceptionSafetyTestBuilder { typename NewOperation, typename = EnableIfTestable> testing::AssertionResult Test(const NewOperation& new_operation) const { - return TestImpl(new_operation, absl::index_sequence_for()); + return TestImpl(new_operation, std::index_sequence_for()); } /* @@ -1092,7 +1092,7 @@ class ExceptionSafetyTestBuilder { template testing::AssertionResult TestImpl(SelectedOperation selected_operation, - absl::index_sequence) const { + std::index_sequence) const { return ExceptionSafetyTest>( factory_, selected_operation, std::get(contracts_)...) .Test(); diff --git a/absl/container/btree_benchmark.cc b/absl/container/btree_benchmark.cc index ee4efbd0..69a81959 100644 --- a/absl/container/btree_benchmark.cc +++ b/absl/container/btree_benchmark.cc @@ -668,15 +668,13 @@ BIG_TYPE_BENCHMARKS(32, 32); template struct BigTypePtr { BigTypePtr() : BigTypePtr(0) {} - explicit BigTypePtr(int x) { - ptr = absl::make_unique>(x); - } + explicit BigTypePtr(int x) { ptr = std::make_unique>(x); } BigTypePtr(const BigTypePtr& other) { - ptr = absl::make_unique>(*other.ptr); + ptr = std::make_unique>(*other.ptr); } BigTypePtr(BigTypePtr&& other) noexcept = default; BigTypePtr& operator=(const BigTypePtr& other) { - ptr = absl::make_unique>(*other.ptr); + ptr = std::make_unique>(*other.ptr); } BigTypePtr& operator=(BigTypePtr&& other) noexcept = default; diff --git a/absl/container/btree_set.h b/absl/container/btree_set.h index 991cb89c..2dbcc2c5 100644 --- a/absl/container/btree_set.h +++ b/absl/container/btree_set.h @@ -805,23 +805,23 @@ struct set_slot_policy { template static void construct(Alloc *alloc, slot_type *slot, Args &&...args) { - absl::allocator_traits::construct(*alloc, slot, - std::forward(args)...); + std::allocator_traits::construct(*alloc, slot, + std::forward(args)...); } template static void construct(Alloc *alloc, slot_type *slot, slot_type *other) { - absl::allocator_traits::construct(*alloc, slot, std::move(*other)); + std::allocator_traits::construct(*alloc, slot, std::move(*other)); } template static void construct(Alloc *alloc, slot_type *slot, const slot_type *other) { - absl::allocator_traits::construct(*alloc, slot, *other); + std::allocator_traits::construct(*alloc, slot, *other); } template static void destroy(Alloc *alloc, slot_type *slot) { - absl::allocator_traits::destroy(*alloc, slot); + std::allocator_traits::destroy(*alloc, slot); } }; diff --git a/absl/container/btree_test.cc b/absl/container/btree_test.cc index dc880a80..f3dca8a1 100644 --- a/absl/container/btree_test.cc +++ b/absl/container/btree_test.cc @@ -1174,7 +1174,7 @@ TEST(Btree, BtreeMapCanHoldMoveOnlyTypes) { std::unique_ptr &v = m["A"]; EXPECT_TRUE(v == nullptr); - v = absl::make_unique("X"); + v = std::make_unique("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 6175a7cc..54e5fd6c 100644 --- a/absl/container/fixed_array_test.cc +++ b/absl/container/fixed_array_test.cc @@ -112,7 +112,7 @@ TEST(FixedArrayTest, CopyCtor) { TEST(FixedArrayTest, MoveCtor) { absl::FixedArray, 10> on_stack(5); for (int i = 0; i < 5; ++i) { - on_stack[i] = absl::make_unique(i); + on_stack[i] = std::make_unique(i); } absl::FixedArray, 10> stack_copy = std::move(on_stack); @@ -121,7 +121,7 @@ TEST(FixedArrayTest, MoveCtor) { absl::FixedArray, 10> allocated(15); for (int i = 0; i < 15; ++i) { - allocated[i] = absl::make_unique(i); + allocated[i] = std::make_unique(i); } absl::FixedArray, 10> alloced_copy = @@ -307,7 +307,7 @@ static void TestArrayOfArrays(int n) { using InnerArray = ConstructionTester[elements_per_inner_array]; // Heap-allocate the FixedArray to avoid blowing the stack frame. auto array_ptr = - absl::make_unique>(n); + std::make_unique>(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 44af56a5..6d37219e 100644 --- a/absl/container/flat_hash_set.h +++ b/absl/container/flat_hash_set.h @@ -552,14 +552,14 @@ struct FlatHashSetPolicy { template static void construct(Allocator* alloc, slot_type* slot, Args&&... args) { - absl::allocator_traits::construct(*alloc, slot, - std::forward(args)...); + std::allocator_traits::construct(*alloc, slot, + std::forward(args)...); } // Return std::true_type in case destroy is trivial. template static auto destroy(Allocator* alloc, slot_type* slot) { - absl::allocator_traits::destroy(*alloc, slot); + std::allocator_traits::destroy(*alloc, slot); return IsDestructionTrivial(); } diff --git a/absl/container/flat_hash_set_test.cc b/absl/container/flat_hash_set_test.cc index f776f387..95ead482 100644 --- a/absl/container/flat_hash_set_test.cc +++ b/absl/container/flat_hash_set_test.cc @@ -109,11 +109,11 @@ TEST(FlatHashSet, MergeExtractInsert) { } }; absl::flat_hash_set, Hash, Eq> set1, set2; - set1.insert(absl::make_unique(7)); - set1.insert(absl::make_unique(17)); + set1.insert(std::make_unique(7)); + set1.insert(std::make_unique(17)); - set2.insert(absl::make_unique(7)); - set2.insert(absl::make_unique(19)); + set2.insert(std::make_unique(7)); + set2.insert(std::make_unique(19)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7), Pointee(19))); @@ -123,7 +123,7 @@ TEST(FlatHashSet, MergeExtractInsert) { EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17), Pointee(19))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - auto node = set1.extract(absl::make_unique(7)); + auto node = set1.extract(std::make_unique(7)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(7)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(17), Pointee(19))); @@ -137,12 +137,12 @@ TEST(FlatHashSet, MergeExtractInsert) { EXPECT_NE(insert_result.position->get(), insert_result.node.value().get()); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - node = set1.extract(absl::make_unique(17)); + node = set1.extract(std::make_unique(17)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(17)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(19))); - node.value() = absl::make_unique(23); + node.value() = std::make_unique(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 1e3ff823..ba96be35 100644 --- a/absl/container/inlined_vector_test.cc +++ b/absl/container/inlined_vector_test.cc @@ -823,7 +823,7 @@ class NotTriviallyDestructible { : p_(new int(*other.p_)) {} NotTriviallyDestructible& operator=(const NotTriviallyDestructible& other) { - p_ = absl::make_unique(*other.p_); + p_ = std::make_unique(*other.p_); return *this; } @@ -1995,7 +1995,7 @@ TEST(AllocatorSupportTest, SizeAllocConstructor) { TEST(InlinedVectorTest, MinimumAllocatorCompilesUsingTraits) { using T = int; using A = std::allocator; - using ATraits = absl::allocator_traits; + using ATraits = std::allocator_traits; struct MinimumAllocator { using value_type = T; diff --git a/absl/container/internal/btree.h b/absl/container/internal/btree.h index 38153829..85e13c9c 100644 --- a/absl/container/internal/btree.h +++ b/absl/container/internal/btree.h @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -2489,7 +2490,7 @@ auto btree

::operator=(const btree &other) -> btree & { 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 @@ auto btree

::operator=(btree &&other) noexcept -> btree & { 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 @@ void btree

::clear() { template void btree

::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 39371a91..d4ce5235 100644 --- a/absl/container/internal/btree_container.h +++ b/absl/container/internal/btree_container.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -80,8 +81,8 @@ class btree_container { explicit btree_container(const allocator_type &alloc) : tree_(key_compare(), alloc) {} - btree_container(const btree_container &other) - : btree_container(other, absl::allocator_traits:: + btree_container(const btree_container& other) + : btree_container(other, std::allocator_traits:: 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 9d5c0555..924172f1 100644 --- a/absl/container/internal/compressed_tuple.h +++ b/absl/container/internal/compressed_tuple.h @@ -86,7 +86,7 @@ struct Storage { T value; constexpr Storage() = default; template - explicit constexpr Storage(absl::in_place_t, V&& v) + explicit constexpr Storage(std::in_place_t, V&& v) : value(std::forward(v)) {} constexpr const T& get() const& { return value; } constexpr T& get() & { return value; } @@ -99,7 +99,7 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage : T { constexpr Storage() = default; template - explicit constexpr Storage(absl::in_place_t, V&& v) : T(std::forward(v)) {} + explicit constexpr Storage(std::in_place_t, V&& v) : T(std::forward(v)) {} constexpr const T& get() const& { return *this; } constexpr T& get() & { return *this; } @@ -112,7 +112,7 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl; template struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC - CompressedTupleImpl, absl::index_sequence, + CompressedTupleImpl, std::index_sequence, 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 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC StorageTag>... { constexpr CompressedTupleImpl() = default; template - explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) - : Storage>(absl::in_place, + explicit constexpr CompressedTupleImpl(std::in_place_t, Vs&&... args) + : Storage>(std::in_place, std::forward(args))... {} friend CompressedTuple; }; template struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC - CompressedTupleImpl, absl::index_sequence, + CompressedTupleImpl, std::index_sequence, false> // We use the dummy identity function as above... : Storage::value, StorageTag, false>... { constexpr CompressedTupleImpl() = default; template - explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) - : Storage, false>(absl::in_place, + explicit constexpr CompressedTupleImpl(std::in_place_t, Vs&&... args) + : Storage, false>(std::in_place, std::forward(args))... {} friend CompressedTuple; }; @@ -204,7 +204,7 @@ struct TupleItemsMoveConstructible template class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple : private internal_compressed_tuple::CompressedTupleImpl< - CompressedTuple, absl::index_sequence_for, + CompressedTuple, std::index_sequence_for, internal_compressed_tuple::ShouldAnyUseBase()> { private: template @@ -224,19 +224,19 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple constexpr CompressedTuple() = default; #endif explicit constexpr CompressedTuple(const Ts&... base) - : CompressedTuple::CompressedTupleImpl(absl::in_place, base...) {} + : CompressedTuple::CompressedTupleImpl(std::in_place, base...) {} template )>>, + void(std::decay_t)>>, internal_compressed_tuple::TupleItemsMoveConstructible< CompressedTuple, 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), std::forward(base)...) {} diff --git a/absl/container/internal/compressed_tuple_test.cc b/absl/container/internal/compressed_tuple_test.cc index 47648c90..96b39177 100644 --- a/absl/container/internal/compressed_tuple_test.cc +++ b/absl/container/internal/compressed_tuple_test.cc @@ -337,11 +337,11 @@ TEST(CompressedTupleTest, NoElements) { TEST(CompressedTupleTest, MoveOnlyElements) { CompressedTuple> str_tup( - absl::make_unique("str")); + std::make_unique("str")); CompressedTuple>, std::unique_ptr> - x(std::move(str_tup), absl::make_unique(5)); + x(std::move(str_tup), std::make_unique(5)); EXPECT_EQ(*x.get<0>().get<0>(), "str"); EXPECT_EQ(*x.get<1>(), 5); @@ -355,7 +355,7 @@ TEST(CompressedTupleTest, MoveOnlyElements) { TEST(CompressedTupleTest, MoveConstructionMoveOnlyElements) { CompressedTuple> base( - absl::make_unique("str")); + std::make_unique("str")); EXPECT_EQ(*base.get<0>(), "str"); CompressedTuple> copy(std::move(base)); diff --git a/absl/container/internal/container_memory.h b/absl/container/internal/container_memory.h index dcf0bd27..fc7633f1 100644 --- a/absl/container/internal/container_memory.h +++ b/absl/container/internal/container_memory.h @@ -63,8 +63,8 @@ void* Allocate(Alloc* alloc, size_t n) { static_assert(Alignment > 0, ""); assert(n && "n must be positive"); using M = AlignedType; - using A = typename absl::allocator_traits::template rebind_alloc; - using AT = typename absl::allocator_traits::template rebind_traits; + using A = typename std::allocator_traits::template rebind_alloc; + using AT = typename std::allocator_traits::template rebind_traits; // 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 @@ template constexpr auto IsDestructionTrivial() { constexpr bool result = std::is_trivially_destructible::value && - std::is_same::template rebind_alloc, std::allocator>::value; return std::integral_constant(); @@ -94,8 +94,8 @@ void Deallocate(Alloc* alloc, void* p, size_t n) { static_assert(Alignment > 0, ""); assert(n && "n must be positive"); using M = AlignedType; - using A = typename absl::allocator_traits::template rebind_alloc; - using AT = typename absl::allocator_traits::template rebind_traits; + using A = typename std::allocator_traits::template rebind_alloc; + using AT = typename std::allocator_traits::template rebind_traits; // 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 @@ namespace memory_internal { // specified in the tuple. template void ConstructFromTupleImpl(Alloc* alloc, T* ptr, Tuple&& t, - absl::index_sequence) { - absl::allocator_traits::construct( + std::index_sequence) { + std::allocator_traits::construct( *alloc, ptr, std::get(std::forward(t))...); } @@ -127,13 +127,13 @@ struct WithConstructedImplF { template decltype(std::declval()(std::declval())) WithConstructedImpl( - Tuple&& t, absl::index_sequence, F&& f) { + Tuple&& t, std::index_sequence, F&& f) { return WithConstructedImplF{std::forward(f)}( std::get(std::forward(t))...); } template -auto TupleRefImpl(T&& t, absl::index_sequence) +auto TupleRefImpl(T&& t, std::index_sequence) -> decltype(std::forward_as_tuple(std::get(std::forward(t))...)) { // NOLINTNEXTLINE(bugprone-use-after-move) return std::forward_as_tuple(std::get(std::forward(t))...); @@ -144,11 +144,11 @@ auto TupleRefImpl(T&& t, absl::index_sequence) template auto TupleRef(T&& t) -> decltype(TupleRefImpl( std::forward(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size::type>::value>())) { return TupleRefImpl( std::forward(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size::type>::value>()); } @@ -169,7 +169,7 @@ template void ConstructFromTuple(Alloc* alloc, T* ptr, Tuple&& t) { memory_internal::ConstructFromTupleImpl( alloc, ptr, std::forward(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size::type>::value>()); } @@ -180,7 +180,7 @@ decltype(std::declval()(std::declval())) WithConstructed(Tuple&& t, F&& f) { return memory_internal::WithConstructedImpl( std::forward(t), - absl::make_index_sequence< + std::make_index_sequence< std::tuple_size::type>::value>(), std::forward(f)); } @@ -397,11 +397,11 @@ struct map_slot_policy { static void construct(Allocator* alloc, slot_type* slot, Args&&... args) { emplace(slot); if (kMutableKeys::value) { - absl::allocator_traits::construct(*alloc, &slot->mutable_value, - std::forward(args)...); + std::allocator_traits::construct(*alloc, &slot->mutable_value, + std::forward(args)...); } else { - absl::allocator_traits::construct(*alloc, &slot->value, - std::forward(args)...); + std::allocator_traits::construct(*alloc, &slot->value, + std::forward(args)...); } } @@ -410,11 +410,11 @@ struct map_slot_policy { static void construct(Allocator* alloc, slot_type* slot, slot_type* other) { emplace(slot); if (kMutableKeys::value) { - absl::allocator_traits::construct( + std::allocator_traits::construct( *alloc, &slot->mutable_value, std::move(other->mutable_value)); } else { - absl::allocator_traits::construct(*alloc, &slot->value, - std::move(other->value)); + std::allocator_traits::construct(*alloc, &slot->value, + std::move(other->value)); } } @@ -423,16 +423,16 @@ struct map_slot_policy { static void construct(Allocator* alloc, slot_type* slot, const slot_type* other) { emplace(slot); - absl::allocator_traits::construct(*alloc, &slot->value, - other->value); + std::allocator_traits::construct(*alloc, &slot->value, + other->value); } template static auto destroy(Allocator* alloc, slot_type* slot) { if (kMutableKeys::value) { - absl::allocator_traits::destroy(*alloc, &slot->mutable_value); + std::allocator_traits::destroy(*alloc, &slot->mutable_value); } else { - absl::allocator_traits::destroy(*alloc, &slot->value); + std::allocator_traits::destroy(*alloc, &slot->value); } return IsDestructionTrivial(); } @@ -460,11 +460,11 @@ struct map_slot_policy { } if (kMutableKeys::value) { - absl::allocator_traits::construct( + std::allocator_traits::construct( *alloc, &new_slot->mutable_value, std::move(old_slot->mutable_value)); } else { - absl::allocator_traits::construct(*alloc, &new_slot->value, - std::move(old_slot->value)); + std::allocator_traits::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 4028413f..18146784 100644 --- a/absl/container/internal/hash_generator_testing.h +++ b/absl/container/internal/hash_generator_testing.h @@ -128,7 +128,7 @@ struct Generator> { template struct Generator> { std::unique_ptr operator()() const { - return absl::make_unique(Generator()()); + return std::make_unique(Generator()()); } }; diff --git a/absl/container/internal/layout.h b/absl/container/internal/layout.h index f49d272a..442e2082 100644 --- a/absl/container/internal/layout.h +++ b/absl/container/internal/layout.h @@ -346,10 +346,10 @@ class LayoutImpl; // can compute offsets). template -class LayoutImpl< - std::tuple, absl::index_sequence, - absl::index_sequence, absl::index_sequence, - absl::index_sequence> { +class LayoutImpl, std::index_sequence, + std::index_sequence, + std::index_sequence, + std::index_sequence> { private: static_assert(sizeof...(Elements) > 0, "At least one field is required"); static_assert(std::conjunction...>::value, @@ -687,10 +687,9 @@ class LayoutImpl< template using LayoutType = LayoutImpl< - std::tuple, StaticSizeSeq, - absl::make_index_sequence, - absl::make_index_sequence, - absl::make_index_sequence, StaticSizeSeq, std::make_index_sequence, + std::make_index_sequence, + std::make_index_sequence>; template @@ -793,11 +792,12 @@ class LayoutWithStaticSizes // internal_layout::LayoutImpl above. Those types are internal to the library // but their methods are public, and they are inherited by `Layout`. template -class Layout : public internal_layout::LayoutWithStaticSizes< - absl::make_index_sequence<0>, Ts...> { +class Layout + : public internal_layout::LayoutWithStaticSizes, + Ts...> { private: using Super = - internal_layout::LayoutWithStaticSizes, + internal_layout::LayoutWithStaticSizes, Ts...>; public: diff --git a/absl/container/internal/layout_test.cc b/absl/container/internal/layout_test.cc index 47fc9f33..e99c56ac 100644 --- a/absl/container/internal/layout_test.cc +++ b/absl/container/internal/layout_test.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -1436,7 +1437,7 @@ class TupleMatcher { testing::MatchResultListener* /* listener */) const { static_assert(std::tuple_size::value == sizeof...(M), ""); return MatchAndExplainImpl( - p, absl::make_index_sequence::value>{}); + p, std::make_index_sequence::value>{}); } // For the matcher concept. Left empty as we don't really need the diagnostics @@ -1446,7 +1447,7 @@ class TupleMatcher { private: template - bool MatchAndExplainImpl(const Tuple& p, absl::index_sequence) const { + bool MatchAndExplainImpl(const Tuple& p, std::index_sequence) 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 3372ea43..71f16df6 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -1909,9 +1909,9 @@ class raw_hash_set { 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::pointer; - using const_pointer = typename absl::allocator_traits< + using const_pointer = typename std::allocator_traits< allocator_type>::template rebind_traits::const_pointer; private: @@ -1975,15 +1975,15 @@ class raw_hash_set { static_assert(sizeof(key_hash_result) >= sizeof(size_t), "`Hash::operator()` should return a `size_t`"); - using AllocTraits = absl::allocator_traits; - using SlotAlloc = typename absl::allocator_traits< + using AllocTraits = std::allocator_traits; + using SlotAlloc = typename std::allocator_traits< allocator_type>::template rebind_alloc; // 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::template rebind_alloc; - using SlotAllocTraits = typename absl::allocator_traits< + typename std::allocator_traits::template rebind_alloc; + using SlotAllocTraits = typename std::allocator_traits< allocator_type>::template rebind_traits; static_assert(std::is_lvalue_reference::value, diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc index d34a0566..59717ef2 100644 --- a/absl/container/internal/raw_hash_set_test.cc +++ b/absl/container/internal/raw_hash_set_test.cc @@ -389,13 +389,13 @@ struct ValuePolicy { template static void construct(Allocator* alloc, slot_type* slot, Args&&... args) { - absl::allocator_traits::construct(*alloc, slot, - std::forward(args)...); + std::allocator_traits::construct(*alloc, slot, + std::forward(args)...); } template static void destroy(Allocator* alloc, slot_type* slot) { - absl::allocator_traits::destroy(*alloc, slot); + std::allocator_traits::destroy(*alloc, slot); } template @@ -2308,7 +2308,7 @@ TEST(Table, NoThrowMoveAssign) { std::is_nothrow_move_assignable>::value); ASSERT_TRUE(std::is_nothrow_move_assignable>::value); ASSERT_TRUE( - absl::allocator_traits>::is_always_equal::value); + std::allocator_traits>::is_always_equal::value); EXPECT_TRUE(std::is_nothrow_move_assignable::value); } diff --git a/absl/container/node_hash_map.h b/absl/container/node_hash_map.h index 6fe1d9f6..e9130058 100644 --- a/absl/container/node_hash_map.h +++ b/absl/container/node_hash_map.h @@ -645,23 +645,22 @@ class NodeHashMapPolicy template 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; PairAlloc pair_alloc(*alloc); - value_type* res = - absl::allocator_traits::allocate(pair_alloc, 1); - absl::allocator_traits::construct(pair_alloc, res, - std::forward(args)...); + value_type* res = std::allocator_traits::allocate(pair_alloc, 1); + std::allocator_traits::construct(pair_alloc, res, + std::forward(args)...); return res; } template 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; PairAlloc pair_alloc(*alloc); - absl::allocator_traits::destroy(pair_alloc, pair); - absl::allocator_traits::deallocate(pair_alloc, pair, 1); + std::allocator_traits::destroy(pair_alloc, pair); + std::allocator_traits::deallocate(pair_alloc, pair, 1); } template diff --git a/absl/container/node_hash_set.h b/absl/container/node_hash_set.h index 4d580988..8fd326b9 100644 --- a/absl/container/node_hash_set.h +++ b/absl/container/node_hash_set.h @@ -548,21 +548,21 @@ struct NodeHashSetPolicy template static T* new_element(Allocator* alloc, Args&&... args) { using ValueAlloc = - typename absl::allocator_traits::template rebind_alloc; + typename std::allocator_traits::template rebind_alloc; ValueAlloc value_alloc(*alloc); - T* res = absl::allocator_traits::allocate(value_alloc, 1); - absl::allocator_traits::construct(value_alloc, res, - std::forward(args)...); + T* res = std::allocator_traits::allocate(value_alloc, 1); + std::allocator_traits::construct(value_alloc, res, + std::forward(args)...); return res; } template static void delete_element(Allocator* alloc, T* elem) { using ValueAlloc = - typename absl::allocator_traits::template rebind_alloc; + typename std::allocator_traits::template rebind_alloc; ValueAlloc value_alloc(*alloc); - absl::allocator_traits::destroy(value_alloc, elem); - absl::allocator_traits::deallocate(value_alloc, elem, 1); + std::allocator_traits::destroy(value_alloc, elem); + std::allocator_traits::deallocate(value_alloc, elem, 1); } template diff --git a/absl/container/node_hash_set_test.cc b/absl/container/node_hash_set_test.cc index b29d0ca2..ab40282a 100644 --- a/absl/container/node_hash_set_test.cc +++ b/absl/container/node_hash_set_test.cc @@ -75,11 +75,11 @@ TEST(NodeHashSet, MergeExtractInsert) { } }; absl::node_hash_set, Hash, Eq> set1, set2; - set1.insert(absl::make_unique(7)); - set1.insert(absl::make_unique(17)); + set1.insert(std::make_unique(7)); + set1.insert(std::make_unique(17)); - set2.insert(absl::make_unique(7)); - set2.insert(absl::make_unique(19)); + set2.insert(std::make_unique(7)); + set2.insert(std::make_unique(19)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7), Pointee(19))); @@ -89,7 +89,7 @@ TEST(NodeHashSet, MergeExtractInsert) { EXPECT_THAT(set1, UnorderedElementsAre(Pointee(7), Pointee(17), Pointee(19))); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - auto node = set1.extract(absl::make_unique(7)); + auto node = set1.extract(std::make_unique(7)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(7)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(17), Pointee(19))); @@ -103,12 +103,12 @@ TEST(NodeHashSet, MergeExtractInsert) { EXPECT_NE(insert_result.position->get(), insert_result.node.value().get()); EXPECT_THAT(set2, UnorderedElementsAre(Pointee(7))); - node = set1.extract(absl::make_unique(17)); + node = set1.extract(std::make_unique(17)); EXPECT_TRUE(node); EXPECT_THAT(node.value(), Pointee(17)); EXPECT_THAT(set1, UnorderedElementsAre(Pointee(19))); - node.value() = absl::make_unique(23); + node.value() = std::make_unique(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 d7cecc3f..0ac92252 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 #include #include "absl/crc/crc32c.h" @@ -144,7 +145,7 @@ void BM_Memcpy(benchmark::State& state) { int string_len = state.range(0); std::string source = TestString(string_len); - auto dest = absl::make_unique(string_len); + auto dest = std::make_unique(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 ebd9c3fe..d639aecb 100644 --- a/absl/crc/internal/crc_x86_arm_combined.cc +++ b/absl/crc/internal/crc_x86_arm_combined.cc @@ -694,53 +694,53 @@ CRCImpl* TryNewCRC32AcceleratedX86ARMCombined() { std::vector> NewCRC32AcceleratedX86ARMCombinedAll() { auto ret = std::vector>(); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); - ret.push_back(absl::make_unique>()); return ret; diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc index 1731197e..9af2583e 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 +#include #include #include "gmock/gmock.h" @@ -2000,7 +2001,7 @@ TEST(Demangle, DemangleStackConsumption) { static void TestOnInput(const char* input) { static const int kOutSize = 1048576; - auto out = absl::make_unique(kOutSize); + auto out = std::make_unique(kOutSize); Demangle(input, out.get(), kOutSize); } diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc index 5eb68e02..28623944 100644 --- a/absl/debugging/symbolize_test.cc +++ b/absl/debugging/symbolize_test.cc @@ -136,7 +136,7 @@ static const char *TrySymbolizeWithLimit(void *pc, int limit) { << "try_symbolize_buffer is too small"; // Use the heap to facilitate heap and buffer sanitizer tools. - auto heap_buffer = absl::make_unique(sizeof(try_symbolize_buffer)); + auto heap_buffer = std::make_unique(sizeof(try_symbolize_buffer)); bool found = absl::Symbolize(pc, heap_buffer.get(), limit); if (found) { CHECK_LT(static_cast( diff --git a/absl/flags/commandlineflag_test.cc b/absl/flags/commandlineflag_test.cc index 54700cf9..b6d01b2a 100644 --- a/absl/flags/commandlineflag_test.cc +++ b/absl/flags/commandlineflag_test.cc @@ -55,7 +55,7 @@ class CommandLineFlagTest : public testing::Test { #if ABSL_FLAGS_STRIP_NAMES GTEST_SKIP() << "This test requires flag names to be present"; #endif - flag_saver_ = absl::make_unique(); + flag_saver_ = std::make_unique(); } void TearDown() override { flag_saver_.reset(); } diff --git a/absl/flags/internal/flag.cc b/absl/flags/internal/flag.cc index 8e894250..0a1dff28 100644 --- a/absl/flags/internal/flag.cc +++ b/absl/flags/internal/flag.cc @@ -443,7 +443,7 @@ std::unique_ptr FlagImpl::SaveState() { switch (ValueStorageKind()) { case FlagValueStorageKind::kValueAndInitBit: case FlagValueStorageKind::kOneWordAtomic: { - return absl::make_unique( + return std::make_unique( *this, OneWordValue().load(std::memory_order_acquire), modified, on_command_line, ModificationCount()); } @@ -454,11 +454,11 @@ std::unique_ptr FlagImpl::SaveState() { seq_lock_.TryRead(cloned, AtomicBufferValue(), Sizeof(op_)); assert(success); static_cast(success); - return absl::make_unique(*this, cloned, modified, - on_command_line, ModificationCount()); + return std::make_unique(*this, cloned, modified, + on_command_line, ModificationCount()); } case FlagValueStorageKind::kHeapAllocated: { - return absl::make_unique( + return std::make_unique( *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 e26b2ada..97715591 100644 --- a/absl/flags/internal/flag.h +++ b/absl/flags/internal/flag.h @@ -178,7 +178,7 @@ struct FixedCharArray { template static constexpr FixedCharArray FromLiteralString( - absl::string_view str, absl::index_sequence) { + absl::string_view str, std::index_sequence) { return (void)str, FixedCharArray({{str[I]..., '\0'}}); } }; @@ -186,7 +186,7 @@ struct FixedCharArray { template constexpr FixedCharArray HelpStringAsArray(int) { return FixedCharArray::FromLiteralString( - Gen::Value(), absl::make_index_sequence{}); + Gen::Value(), std::make_index_sequence{}); } template diff --git a/absl/flags/reflection_test.cc b/absl/flags/reflection_test.cc index 68abeda4..996a458f 100644 --- a/absl/flags/reflection_test.cc +++ b/absl/flags/reflection_test.cc @@ -38,7 +38,7 @@ class ReflectionTest : public testing::Test { #if ABSL_FLAGS_STRIP_NAMES GTEST_SKIP() << "This test requires flag names to be present"; #endif - flag_saver_ = absl::make_unique(); + flag_saver_ = std::make_unique(); } void TearDown() override { flag_saver_.reset(); } diff --git a/absl/functional/any_invocable.h b/absl/functional/any_invocable.h index 4ba4fe3e..2fddb72f 100644 --- a/absl/functional/any_invocable.h +++ b/absl/functional/any_invocable.h @@ -203,14 +203,13 @@ class ABSL_NULLABILITY_COMPATIBLE ABSL_ATTRIBUTE_OWNER AnyInvocable // Example: // // AnyInvocable func( - // absl::in_place_type, arg1, arg2); + // std::in_place_type, arg1, arg2); // template ::value>> - explicit AnyInvocable(absl::in_place_type_t, Args&&... args) - : Impl(absl::in_place_type>, - std::forward(args)...) { + explicit AnyInvocable(std::in_place_type_t, Args&&... args) + : Impl(std::in_place_type>, std::forward(args)...) { static_assert(std::is_same>::value, "The explicit template argument of in_place_type is required " "to be an unqualified object type."); @@ -220,9 +219,9 @@ class ABSL_NULLABILITY_COMPATIBLE ABSL_ATTRIBUTE_OWNER AnyInvocable template &, Args...>::value>> - explicit AnyInvocable(absl::in_place_type_t, - std::initializer_list ilist, Args&&... args) - : Impl(absl::in_place_type>, ilist, + explicit AnyInvocable(std::in_place_type_t, std::initializer_list ilist, + Args&&... args) + : Impl(std::in_place_type>, ilist, std::forward(args)...) { static_assert(std::is_same>::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 46082cab..77a785ad 100644 --- a/absl/functional/any_invocable_test.cc +++ b/absl/functional/any_invocable_test.cc @@ -567,7 +567,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceConstruction) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type, 5); + AnyInvType fun(std::in_place_type, 5); EXPECT_TRUE(static_cast(fun)); EXPECT_EQ(29, TypeParam::ToThisParam(fun)(7, 8, 9).value); @@ -577,7 +577,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceConstructionInitializerList) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type, {1, 2, 3, 4}, 5); + AnyInvType fun(std::in_place_type, {1, 2, 3, 4}, 5); EXPECT_TRUE(static_cast(fun)); EXPECT_EQ(39, TypeParam::ToThisParam(fun)(7, 8, 9).value); @@ -587,7 +587,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceNullFunPtrConstruction) { using AnyInvType = typename TypeParam::AnyInvType; using UnqualifiedFunType = typename TypeParam::UnqualifiedFunType; - AnyInvType fun(absl::in_place_type, nullptr); + AnyInvType fun(std::in_place_type, nullptr); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast(fun)); @@ -597,7 +597,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceNullFunPtrConstructionValueInit) { using AnyInvType = typename TypeParam::AnyInvType; using UnqualifiedFunType = typename TypeParam::UnqualifiedFunType; - AnyInvType fun(absl::in_place_type); + AnyInvType fun(std::in_place_type); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast(fun)); @@ -607,7 +607,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceNullMemFunPtrConstruction) { using AnyInvType = typename TypeParam::AnyInvType; using MemFunPtrType = typename TypeParam::MemFunPtrType; - AnyInvType fun(absl::in_place_type, nullptr); + AnyInvType fun(std::in_place_type, nullptr); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast(fun)); @@ -617,7 +617,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceNullMemFunPtrConstructionValueInit) { using AnyInvType = typename TypeParam::AnyInvType; using MemFunPtrType = typename TypeParam::MemFunPtrType; - AnyInvType fun(absl::in_place_type); + AnyInvType fun(std::in_place_type); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast(fun)); @@ -627,7 +627,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceNullMemObjPtrConstruction) { using UnaryAnyInvType = typename TypeParam::UnaryAnyInvType; using MemObjPtrType = typename TypeParam::MemObjPtrType; - UnaryAnyInvType fun(absl::in_place_type, nullptr); + UnaryAnyInvType fun(std::in_place_type, nullptr); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast(fun)); @@ -637,7 +637,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceNullMemObjPtrConstructionValueInit) { using UnaryAnyInvType = typename TypeParam::UnaryAnyInvType; using MemObjPtrType = typename TypeParam::MemObjPtrType; - UnaryAnyInvType fun(absl::in_place_type); + UnaryAnyInvType fun(std::in_place_type); // In-place construction does not lead to empty. EXPECT_TRUE(static_cast(fun)); @@ -647,7 +647,7 @@ TYPED_TEST_P(AnyInvTestBasic, InPlaceVoidCovarianceConstruction) { using VoidAnyInvType = typename TypeParam::VoidAnyInvType; using AddType = typename TypeParam::AddType; - VoidAnyInvType fun(absl::in_place_type, 5); + VoidAnyInvType fun(std::in_place_type, 5); EXPECT_TRUE(static_cast(fun)); } @@ -667,7 +667,7 @@ TYPED_TEST_P(AnyInvTestBasic, MoveConstructionFromNonEmpty) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type, 5); + AnyInvType source_fun(std::in_place_type, 5); AnyInvType fun(std::move(source_fun)); EXPECT_TRUE(static_cast(fun)); @@ -692,7 +692,7 @@ TYPED_TEST_P(AnyInvTestBasic, ComparisonWithNullptrNonempty) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type, 5); + AnyInvType fun(std::in_place_type, 5); EXPECT_FALSE(fun == nullptr); EXPECT_FALSE(nullptr == fun); @@ -729,7 +729,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, MoveAssignEmptyLhsNonemptyRhs) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type, 5); + AnyInvType source_fun(std::in_place_type, 5); AnyInvType fun; fun = std::move(source_fun); @@ -743,7 +743,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, MoveAssignNonemptyEmptyLhsRhs) { using AddType = typename TypeParam::AddType; AnyInvType source_fun; - AnyInvType fun(absl::in_place_type, 5); + AnyInvType fun(std::in_place_type, 5); fun = std::move(source_fun); @@ -754,8 +754,8 @@ TYPED_TEST_P(AnyInvTestCombinatoric, MoveAssignNonemptyLhsNonemptyRhs) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type, 5); - AnyInvType fun(absl::in_place_type, 20); + AnyInvType source_fun(std::in_place_type, 5); + AnyInvType fun(std::in_place_type, 20); fun = std::move(source_fun); @@ -776,7 +776,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SelfMoveAssignNonempty) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType source_fun(absl::in_place_type, 5); + AnyInvType source_fun(std::in_place_type, 5); source_fun = std::move(source_fun); // This space intentionally left blank. @@ -1027,7 +1027,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SwapEmptyLhsNonemptyRhs) { // Swap idiom { AnyInvType fun; - AnyInvType other(absl::in_place_type, 5); + AnyInvType other(std::in_place_type, 5); using std::swap; swap(fun, other); @@ -1044,7 +1044,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SwapEmptyLhsNonemptyRhs) { // Member swap { AnyInvType fun; - AnyInvType other(absl::in_place_type, 5); + AnyInvType other(std::in_place_type, 5); fun.swap(other); @@ -1063,7 +1063,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SwapNonemptyLhsEmptyRhs) { // Swap idiom { - AnyInvType fun(absl::in_place_type, 5); + AnyInvType fun(std::in_place_type, 5); AnyInvType other; using std::swap; @@ -1080,7 +1080,7 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SwapNonemptyLhsEmptyRhs) { // Member swap { - AnyInvType fun(absl::in_place_type, 5); + AnyInvType fun(std::in_place_type, 5); AnyInvType other; fun.swap(other); @@ -1100,8 +1100,8 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SwapNonemptyLhsNonemptyRhs) { // Swap idiom { - AnyInvType fun(absl::in_place_type, 5); - AnyInvType other(absl::in_place_type, 6); + AnyInvType fun(std::in_place_type, 5); + AnyInvType other(std::in_place_type, 6); using std::swap; swap(fun, other); @@ -1118,8 +1118,8 @@ TYPED_TEST_P(AnyInvTestCombinatoric, SwapNonemptyLhsNonemptyRhs) { // Member swap { - AnyInvType fun(absl::in_place_type, 5); - AnyInvType other(absl::in_place_type, 6); + AnyInvType fun(std::in_place_type, 5); + AnyInvType other(std::in_place_type, 6); fun.swap(other); @@ -1383,7 +1383,7 @@ TYPED_TEST_P(AnyInvTestRvalue, NonConstCrashesOnSecondCall) { using AnyInvType = typename TypeParam::AnyInvType; using AddType = typename TypeParam::AddType; - AnyInvType fun(absl::in_place_type, 5); + AnyInvType fun(std::in_place_type, 5); EXPECT_TRUE(static_cast(fun)); std::move(fun)(7, 8, 9); diff --git a/absl/functional/bind_back.h b/absl/functional/bind_back.h index 5d81ad23..ba31fb43 100644 --- a/absl/functional/bind_back.h +++ b/absl/functional/bind_back.h @@ -69,7 +69,7 @@ template constexpr functional_internal::bind_back_t bind_back( F&& func, BoundArgs&&... args) { return functional_internal::bind_back_t( - absl::in_place, std::forward(func), std::forward(args)...); + std::in_place, std::forward(func), std::forward(args)...); } #endif diff --git a/absl/functional/bind_back_test.cc b/absl/functional/bind_back_test.cc index 37b8180e..77accc4d 100644 --- a/absl/functional/bind_back_test.cc +++ b/absl/functional/bind_back_test.cc @@ -179,11 +179,11 @@ TEST(BindTest, MemberFunctionFreeInstance) { int Sink(std::unique_ptr p) { return *p; } -std::unique_ptr Factory(int n) { return absl::make_unique(n); } +std::unique_ptr Factory(int n) { return std::make_unique(n); } TEST(BindTest, NonCopyableArg) { - EXPECT_EQ(42, absl::bind_back(Sink)(absl::make_unique(42))); - EXPECT_EQ(42, absl::bind_back(Sink, absl::make_unique(42))()); + EXPECT_EQ(42, absl::bind_back(Sink)(std::make_unique(42))); + EXPECT_EQ(42, absl::bind_back(Sink, std::make_unique(42))()); } TEST(BindTest, NonCopyableResult) { @@ -206,7 +206,7 @@ int GetMember(FalseCopyable> x) { return *x.m; } TEST(BindTest, WrappedMoveOnly) { FalseCopyable> x; - x.m = absl::make_unique(42); + x.m = std::make_unique(42); auto f = absl::bind_back(&GetMember, std::move(x)); EXPECT_EQ(42, std::move(f)()); } diff --git a/absl/functional/bind_front.h b/absl/functional/bind_front.h index 594e773a..09adc093 100644 --- a/absl/functional/bind_front.h +++ b/absl/functional/bind_front.h @@ -190,7 +190,7 @@ template constexpr functional_internal::bind_front_t bind_front( F&& func, BoundArgs&&... args) { return functional_internal::bind_front_t( - absl::in_place, std::forward(func), std::forward(args)...); + std::in_place, std::forward(func), std::forward(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 5d94eccf..a759dbe7 100644 --- a/absl/functional/bind_front_test.cc +++ b/absl/functional/bind_front_test.cc @@ -169,11 +169,11 @@ int Sink(std::unique_ptr p) { return *p; } -std::unique_ptr Factory(int n) { return absl::make_unique(n); } +std::unique_ptr Factory(int n) { return std::make_unique(n); } TEST(BindTest, NonCopyableArg) { - EXPECT_EQ(42, absl::bind_front(Sink)(absl::make_unique(42))); - EXPECT_EQ(42, absl::bind_front(Sink, absl::make_unique(42))()); + EXPECT_EQ(42, absl::bind_front(Sink)(std::make_unique(42))); + EXPECT_EQ(42, absl::bind_front(Sink, std::make_unique(42))()); } TEST(BindTest, NonCopyableResult) { @@ -196,7 +196,7 @@ int GetMember(FalseCopyable> x) { return *x.m; } TEST(BindTest, WrappedMoveOnly) { FalseCopyable> x; - x.m = absl::make_unique(42); + x.m = std::make_unique(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 97aa3d5f..81da61a2 100644 --- a/absl/functional/function_ref_test.cc +++ b/absl/functional/function_ref_test.cc @@ -83,11 +83,11 @@ TEST(FunctionRefTest, NoExceptFunction) { TEST(FunctionRefTest, ForwardsArgs) { auto l = [](std::unique_ptr i) { return *i; }; FunctionRef)> ref(l); - EXPECT_EQ(42, ref(absl::make_unique(42))); + EXPECT_EQ(42, ref(std::make_unique(42))); } TEST(FunctionRef, ReturnMoveOnly) { - auto l = [] { return absl::make_unique(29); }; + auto l = [] { return std::make_unique(29); }; FunctionRef()> ref(l); EXPECT_EQ(29, *ref()); } diff --git a/absl/functional/internal/any_invocable.h b/absl/functional/internal/any_invocable.h index 66168c65..262385a3 100644 --- a/absl/functional/internal/any_invocable.h +++ b/absl/functional/internal/any_invocable.h @@ -342,12 +342,12 @@ ReturnType RemoteInvoker( //////////////////////////////////////////////////////////////////////////////// // // 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 struct IsInPlaceType : std::false_type {}; template -struct IsInPlaceType> : std::true_type {}; +struct IsInPlaceType> : std::true_type {}; // //////////////////////////////////////////////////////////////////////////////// @@ -464,7 +464,7 @@ class CoreImpl { // invocation of the Invocable. The unqualified type is the target object // type to be stored. template - explicit CoreImpl(absl::in_place_type_t, Args&&... args) { + explicit CoreImpl(std::in_place_type_t, Args&&... args) { InitializeStorage(std::forward(args)...); } @@ -696,11 +696,11 @@ using CanAssignReferenceWrapper = TrueAlias< \ /*SFINAE constraint to check if F is invocable with the proper signature*/ \ template \ - using CallIsValid = TrueAlias inv_quals, P...>, \ - std::is_same< \ - ReturnType, \ - std::invoke_result_t inv_quals, P...>>>::value>>; \ + using CallIsValid = TrueAlias inv_quals, P...>, \ + std::is_same inv_quals, P...>>>:: \ + value>>; \ \ /*SFINAE constraint to check if F is nothrow-invocable when necessary*/ \ template \ @@ -722,8 +722,8 @@ using CanAssignReferenceWrapper = TrueAlias< \ /*Forward along the in-place construction parameters.*/ \ template \ - explicit Impl(absl::in_place_type_t, Args&&... args) \ - : Core(absl::in_place_type inv_quals>, \ + explicit Impl(std::in_place_type_t, Args&&... args) \ + : Core(std::in_place_type inv_quals>, \ std::forward(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 index 35423da9..71cfc7a2 100644 --- a/absl/functional/internal/back_binder.h +++ b/absl/functional/internal/back_binder.h @@ -31,7 +31,7 @@ namespace functional_internal { // Invoke the method, expanding the tuple of bound arguments. template -constexpr R ApplyBack(Tuple&& bound, absl::index_sequence, +constexpr R ApplyBack(Tuple&& bound, std::index_sequence, Args&&... free) { return std::invoke(std::forward(bound).template get<0>(), std::forward(free)..., @@ -41,13 +41,13 @@ constexpr R ApplyBack(Tuple&& bound, absl::index_sequence, template class BackBinder { using BoundArgsT = absl::container_internal::CompressedTuple; - using Idx = absl::make_index_sequence; + using Idx = std::make_index_sequence; BoundArgsT bound_args_; public: template - constexpr explicit BackBinder(absl::in_place_t, Ts&&... ts) + constexpr explicit BackBinder(std::in_place_t, Ts&&... ts) : bound_args_(std::forward(ts)...) {} template -R Apply(Tuple&& bound, absl::index_sequence, Args&&... free) { +R Apply(Tuple&& bound, std::index_sequence, Args&&... free) { return std::invoke(std::forward(bound).template get()..., std::forward(free)...); } @@ -39,13 +39,13 @@ R Apply(Tuple&& bound, absl::index_sequence, Args&&... free) { template class FrontBinder { using BoundArgsT = absl::container_internal::CompressedTuple; - using Idx = absl::make_index_sequence; + using Idx = std::make_index_sequence; BoundArgsT bound_args_; public: template - constexpr explicit FrontBinder(absl::in_place_t, Ts&&... ts) + constexpr explicit FrontBinder(std::in_place_t, Ts&&... ts) : bound_args_(std::forward(ts)...) {} template (), // + std::make_unique(), // shared1, shared2, shared_null, // std::make_shared()), SmartPointerEq{})); diff --git a/absl/hash/hash_testing.h b/absl/hash/hash_testing.h index 3740ba95..66a15451 100644 --- a/absl/hash/hash_testing.h +++ b/absl/hash/hash_testing.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -131,7 +132,7 @@ ABSL_NAMESPACE_BEGIN // } // 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 @@ struct ContainerAsVector> { using Out = std::vector; template - static Out DoImpl(const std::tuple& tuple, absl::index_sequence) { + static Out DoImpl(const std::tuple& tuple, std::index_sequence) { return Out{&std::get(tuple)...}; } static Out Do(const std::tuple& values) { - return DoImpl(values, absl::index_sequence_for()); + return DoImpl(values, std::index_sequence_for()); } }; diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 760dd8c0..88376797 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -604,7 +604,7 @@ AbslHashValue(H hash_state, const std::pair& p) { // Helper function for hashing a tuple. The third argument should // be an index_sequence running from 0 to tuple_size - 1. template -H hash_tuple(H hash_state, const Tuple& t, absl::index_sequence) { +H hash_tuple(H hash_state, const Tuple& t, std::index_sequence) { return H::combine(std::move(hash_state), std::get(t)...); } @@ -619,7 +619,7 @@ typename std::enable_if...>::value, H>::type #endif // _MSC_VER AbslHashValue(H hash_state, const std::tuple& t) { return hash_internal::hash_tuple(std::move(hash_state), t, - absl::make_index_sequence()); + std::make_index_sequence()); } // ----------------------------------------------------------------------------- diff --git a/absl/log/internal/log_message.cc b/absl/log/internal/log_message.cc index 6c2350dd..d253b0c5 100644 --- a/absl/log/internal/log_message.cc +++ b/absl/log/internal/log_message.cc @@ -279,8 +279,8 @@ LogMessage::LogMessage(const char* absl_nonnull file, int line, : LogMessage(absl::string_view(file), line, severity) {} LogMessage::LogMessage(absl::string_view file, int line, absl::LogSeverity severity) - : data_(absl::make_unique(file, line, severity, - absl::Now())) { + : data_( + std::make_unique(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 a4deebcc..7a1b82c3 100644 --- a/absl/log/internal/structured_proto_test.cc +++ b/absl/log/internal/structured_proto_test.cc @@ -71,7 +71,7 @@ INSTANTIATE_TEST_SUITE_P( { 42, StructuredProtoField::Value{ - absl::in_place_type, + std::in_place_type, int32_t{23}, }, }, @@ -82,7 +82,7 @@ INSTANTIATE_TEST_SUITE_P( { 42, StructuredProtoField::Value{ - absl::in_place_type, + std::in_place_type, int64_t{23}, }, }, @@ -103,7 +103,7 @@ INSTANTIATE_TEST_SUITE_P( { 42, StructuredProtoField::Value{ - absl::in_place_type, + std::in_place_type, int32_t{23}, }, }, diff --git a/absl/log/internal/vlog_config_benchmark.cc b/absl/log/internal/vlog_config_benchmark.cc index 9004e2ee..9438324c 100644 --- a/absl/log/internal/vlog_config_benchmark.cc +++ b/absl/log/internal/vlog_config_benchmark.cc @@ -45,7 +45,7 @@ class SyntheticBinary { const size_t max_sites_per_tu, const int num_shuffles) { per_tu_data_.reserve(num_tus); - auto sites = absl::make_unique(num_tus * max_sites_per_tu); + auto sites = std::make_unique(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 @@ class SyntheticBinary { absl::LogUniform(bitgen_, 1, max_sites_per_tu), absl::LogUniform(bitgen_, 0, max_extra_static_data_bytes_per_tu)); - auto buf = absl::make_unique(layout.AllocSize()); + auto buf = std::make_unique(layout.AllocSize()); layout.PoisonPadding(buf.get()); memcpy(layout.Pointer<0>(buf.get()), filename.c_str(), filename.size() + 1); @@ -78,7 +78,7 @@ class SyntheticBinary { std::memory_order_seq_cst); } // Now do some shufflin'. - auto new_sites = absl::make_unique(num_sites_); + auto new_sites = std::make_unique(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 213e3524..294012ba 100644 --- a/absl/log/log_streamer.h +++ b/absl/log/log_streamer.h @@ -84,7 +84,7 @@ class LogStreamer final { : 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 42736939..fd7c10bc 100644 --- a/absl/log/scoped_mock_log_test.cc +++ b/absl/log/scoped_mock_log_test.cc @@ -261,7 +261,7 @@ TEST(ScopedMockLogTest, NoSequenceWithMultipleThreads) { TEST(ScopedMockLogTsanTest, ScopedMockLogCanBeDeletedWhenAnotherThreadIsLogging) { - auto log = absl::make_unique(); + auto log = std::make_unique(); 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 2c897f80..9958215f 100644 --- a/absl/memory/memory.h +++ b/absl/memory/memory.h @@ -58,7 +58,7 @@ ABSL_NAMESPACE_BEGIN // std::unique_ptr x(NewX(1, 2)); // // While `absl::WrapUnique` is useful for capturing the output of a raw -// pointer factory, prefer 'absl::make_unique(args...)' over +// pointer factory, prefer 'std::make_unique(args...)' over // 'absl::WrapUnique(new T(args...))'. // // auto x = WrapUnique(new X(1, 2)); // works, but nonideal. @@ -117,7 +117,7 @@ struct MakeUniqueResult { // 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 @@ inline std::nullptr_t RawPtr(std::nullptr_t) { return nullptr; } // // Example: // -// auto up = absl::make_unique(10); +// auto up = std::make_unique(10); // auto sp = absl::ShareUniquePtr(std::move(up)); // shared_ptr // CHECK_EQ(*sp, 10); // CHECK(up == nullptr); diff --git a/absl/memory/memory_test.cc b/absl/memory/memory_test.cc index aeb60011..935b424c 100644 --- a/absl/memory/memory_test.cc +++ b/absl/memory/memory_test.cc @@ -195,7 +195,7 @@ TEST(RawPtrTest, Zero) { } TEST(ShareUniquePtrTest, Share) { - auto up = absl::make_unique(); + auto up = std::make_unique(); int* rp = up.get(); auto sp = absl::ShareUniquePtr(std::move(up)); EXPECT_EQ(sp.get(), rp); diff --git a/absl/random/internal/distribution_caller.h b/absl/random/internal/distribution_caller.h index d14fa854..1416aba1 100644 --- a/absl/random/internal/distribution_caller.h +++ b/absl/random/internal/distribution_caller.h @@ -62,7 +62,7 @@ struct DistributionCaller { ResultT result; if (!RandomMockingAccess::InvokeMock(urbg, FastTypeId(), &arg_tuple, &result)) { - auto dist = absl::make_from_tuple(arg_tuple); + auto dist = std::make_from_tuple(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 a86c39d1..b4407178 100644 --- a/absl/random/internal/salted_seed_seq.h +++ b/absl/random/internal/salted_seed_seq.h @@ -49,11 +49,11 @@ class SaltedSeedSeq { using inner_sequence_type = SSeq; using result_type = typename SSeq::result_type; - SaltedSeedSeq() : seq_(absl::make_unique()) {} + SaltedSeedSeq() : seq_(std::make_unique()) {} template SaltedSeedSeq(Iterator begin, Iterator end) - : seq_(absl::make_unique(begin, end)) {} + : seq_(std::make_unique(begin, end)) {} template SaltedSeedSeq(std::initializer_list il) diff --git a/absl/random/mocking_bit_gen.h b/absl/random/mocking_bit_gen.h index 74aa17d8..6117e7c2 100644 --- a/absl/random/mocking_bit_gen.h +++ b/absl/random/mocking_bit_gen.h @@ -106,7 +106,7 @@ class MockingBitGen { static auto GetMockFnType(ResultT, std::tuple) -> ::testing::MockFunction; - // 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 @@ class MockingBitGen { // Requires tuple_args to point to a ArgTupleT, which is a // std::tuple used to invoke the mock function. Requires result // to point to a ResultT, which is the result of the call. - *static_cast(result) = absl::apply( + *static_cast(result) = std::apply( MockFnCaller{&mock_fn_}, *static_cast(args_tuple)); } @@ -189,7 +189,7 @@ class MockingBitGen { FunctionHolderImpl; auto& mock = mocks_[type]; if (!mock) { - mock = absl::make_unique(); + mock = std::make_unique(); } return static_cast(mock.get())->mock_fn_; } diff --git a/absl/status/internal/status_internal.cc b/absl/status/internal/status_internal.cc index 6e792344..1397de72 100644 --- a/absl/status/internal/status_internal.cc +++ b/absl/status/internal/status_internal.cc @@ -81,7 +81,7 @@ std::optional StatusRep::GetPayload( void StatusRep::SetPayload(absl::string_view type_url, absl::Cord payload) { if (payloads_ == nullptr) { - payloads_ = absl::make_unique(); + payloads_ = std::make_unique(); } std::optional index = @@ -223,7 +223,7 @@ StatusRep* absl_nonnull StatusRep::CloneAndUnref() const { } std::unique_ptr payloads; if (payloads_) { - payloads = absl::make_unique(*payloads_); + payloads = std::make_unique(*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 ccfdedb7..de56519f 100644 --- a/absl/status/internal/statusor_internal.h +++ b/absl/status/internal/statusor_internal.h @@ -117,7 +117,7 @@ using IsDirectInitializationValid = std::disjunction< std::negation, absl::remove_cvref_t>, std::is_same>, - std::is_same>, + std::is_same>, IsDirectInitializationAmbiguous>>>>; // This trait detects whether `StatusOr::operator=(U&&)` is ambiguous, which @@ -149,7 +149,7 @@ using IsForwardingAssignmentValid = std::disjunction< std::negation, absl::remove_cvref_t>, std::is_same>, - std::is_same>, + std::is_same>, IsForwardingAssignmentAmbiguous>>>; template @@ -194,7 +194,7 @@ template using IsConstructionFromStatusValid = std::conjunction< std::negation, absl::remove_cvref_t>>, std::negation>>, - std::negation>>, + std::negation>>, Equality>, std::is_constructible, std::negation>>; @@ -325,7 +325,7 @@ class StatusOrData { } template - explicit StatusOrData(absl::in_place_t, Args&&... args) + explicit StatusOrData(std::in_place_t, Args&&... args) : data_(std::forward(args)...) { MakeStatus(); } diff --git a/absl/status/statusor.h b/absl/status/statusor.h index 0af1d752..eedd99fa 100644 --- a/absl/status/statusor.h +++ b/absl/status/statusor.h @@ -416,9 +416,9 @@ class StatusOr : private internal_statusor::OperatorBase, // Constructs the inner value `T` in-place using the provided args, using the // `T(args...)` constructor. template - explicit StatusOr(absl::in_place_t, Args&&... args); + explicit StatusOr(std::in_place_t, Args&&... args); template - explicit StatusOr(absl::in_place_t, std::initializer_list ilist, + explicit StatusOr(std::in_place_t, std::initializer_list ilist, Args&&... args); // Constructs the inner value `T` in-place using the provided args, using the @@ -430,29 +430,29 @@ class StatusOr : private internal_statusor::OperatorBase, // `J` is convertible to `T`. template ::value, - int> = 0> + false, T, U, false>::value, + int> = 0> StatusOr(U&& u) // NOLINT - : StatusOr(absl::in_place, std::forward(u)) {} + : StatusOr(std::in_place, std::forward(u)) {} template ::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)) {} + : StatusOr(std::in_place, std::forward(u)) {} template ::value, - int> = 0> + true, T, U, false>::value, + int> = 0> explicit StatusOr(U&& u) // NOLINT - : StatusOr(absl::in_place, std::forward(u)) {} + : StatusOr(std::in_place, std::forward(u)) {} template ::value, int> = 0> explicit StatusOr(U&& u ABSL_ATTRIBUTE_LIFETIME_BOUND) // NOLINT - : StatusOr(absl::in_place, std::forward(u)) {} + : StatusOr(std::in_place, std::forward(u)) {} // StatusOr::ok() // @@ -747,14 +747,14 @@ inline void StatusOr::Assign(StatusOr&& other) { } template template -StatusOr::StatusOr(absl::in_place_t, Args&&... args) - : Base(absl::in_place, std::forward(args)...) {} +StatusOr::StatusOr(std::in_place_t, Args&&... args) + : Base(std::in_place, std::forward(args)...) {} template template -StatusOr::StatusOr(absl::in_place_t, std::initializer_list ilist, +StatusOr::StatusOr(std::in_place_t, std::initializer_list ilist, Args&&... args) - : Base(absl::in_place, ilist, std::forward(args)...) {} + : Base(std::in_place, ilist, std::forward(args)...) {} template const Status& StatusOr::status() const& { diff --git a/absl/status/statusor_test.cc b/absl/status/statusor_test.cc index bd2c10e2..fc558f66 100644 --- a/absl/status/statusor_test.cc +++ b/absl/status/statusor_test.cc @@ -115,7 +115,7 @@ class CopyNoAssign { absl::StatusOr> ReturnUniquePtr() { // Uses implicit constructor from T&& - return absl::make_unique(0); + return std::make_unique(0); } TEST(StatusOr, ElementType) { @@ -358,7 +358,7 @@ struct Foo { }; TEST(StatusOr, InPlaceConstruction) { - EXPECT_THAT(absl::StatusOr(absl::in_place, 10), + EXPECT_THAT(absl::StatusOr(std::in_place, 10), IsOkAndHolds(Field(&Foo::x, 10))); } @@ -370,8 +370,8 @@ struct InPlaceHelper { }; TEST(StatusOr, InPlaceInitListConstruction) { - absl::StatusOr status_or(absl::in_place, {10, 11, 12}, - absl::make_unique(13)); + absl::StatusOr status_or(std::in_place, {10, 11, 12}, + std::make_unique(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, Emplace) { } TEST(StatusOr, EmplaceInitializerList) { - absl::StatusOr status_or(absl::in_place, {10, 11, 12}, - absl::make_unique(13)); - status_or.emplace({1, 2, 3}, absl::make_unique(4)); + absl::StatusOr status_or(std::in_place, {10, 11, 12}, + std::make_unique(13)); + status_or.emplace({1, 2, 3}, std::make_unique(4)); EXPECT_THAT(status_or, IsOkAndHolds(AllOf(Field(&InPlaceHelper::x, ElementsAre(1, 2, 3)), Field(&InPlaceHelper::y, Pointee(4))))); @@ -400,7 +400,7 @@ TEST(StatusOr, EmplaceInitializerList) { 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(4)); + status_or.emplace({1, 2, 3}, std::make_unique(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, ImplicitConstructionFromInitliazerList) { TEST(StatusOr, UniquePtrImplicitConstruction) { auto status_or = absl::implicit_cast>>( - absl::make_unique()); + std::make_unique()); EXPECT_THAT(status_or, IsOkAndHolds(Ne(nullptr))); } @@ -903,7 +903,7 @@ TEST(StatusOr, ImplicitCastFromInitializerList) { TEST(StatusOr, UniquePtrImplicitAssignment) { absl::StatusOr> status_or; - status_or = absl::make_unique(); + status_or = std::make_unique(); EXPECT_THAT(status_or, IsOkAndHolds(Ne(nullptr))); } @@ -1398,14 +1398,14 @@ TEST(StatusOr, ValueOrDefault) { } TEST(StatusOr, MoveOnlyValueOrOk) { - EXPECT_THAT(absl::StatusOr>(absl::make_unique(0)) - .value_or(absl::make_unique(-1)), + EXPECT_THAT(absl::StatusOr>(std::make_unique(0)) + .value_or(std::make_unique(-1)), Pointee(0)); } TEST(StatusOr, MoveOnlyValueOrDefault) { EXPECT_THAT(absl::StatusOr>(absl::CancelledError()) - .value_or(absl::make_unique(-1)), + .value_or(std::make_unique(-1)), Pointee(-1)); } diff --git a/absl/strings/internal/cordz_sample_token_test.cc b/absl/strings/internal/cordz_sample_token_test.cc index 7152603d..487396b8 100644 --- a/absl/strings/internal/cordz_sample_token_test.cc +++ b/absl/strings/internal/cordz_sample_token_test.cc @@ -187,7 +187,7 @@ TEST(CordzSampleTokenTest, MultiThreaded) { } } else { // 5) Sample - token = absl::make_unique(); + token = std::make_unique(); } } } diff --git a/absl/strings/internal/str_format/bind.h b/absl/strings/internal/str_format/bind.h index 120bc355..075a9d52 100644 --- a/absl/strings/internal/str_format/bind.h +++ b/absl/strings/internal/str_format/bind.h @@ -116,7 +116,7 @@ class FormatSpecTemplate } template - static bool CheckMatches(absl::index_sequence) { + static bool CheckMatches(std::index_sequence) { bool res[] = {true, CheckMatch()...}; (void)res; return true; @@ -173,7 +173,7 @@ class FormatSpecTemplate FormatSpecTemplate(const ExtendedParsedFormat& pc) // NOLINT : Base(&pc) { CheckArity(); - CheckMatches(absl::make_index_sequence{}); + CheckMatches(std::make_index_sequence{}); } }; diff --git a/absl/strings/str_join_test.cc b/absl/strings/str_join_test.cc index cd52e11d..1c0ffe1f 100644 --- a/absl/strings/str_join_test.cc +++ b/absl/strings/str_join_test.cc @@ -501,12 +501,12 @@ TEST(StrJoin, Tuple) { absl::StrJoin(std::make_tuple(&x, &y, &z), "-", absl::DereferenceFormatter(TestFormatter()))); EXPECT_EQ("0x0000000a-hell-3.", - absl::StrJoin(std::make_tuple(absl::make_unique(x), - absl::make_unique(y), - absl::make_unique(z)), + absl::StrJoin(std::make_tuple(std::make_unique(x), + std::make_unique(y), + std::make_unique(z)), "-", absl::DereferenceFormatter(TestFormatter()))); EXPECT_EQ("0x0000000a-hell-3.", - absl::StrJoin(std::make_tuple(absl::make_unique(x), &y, &z), + absl::StrJoin(std::make_tuple(std::make_unique(x), &y, &z), "-", absl::DereferenceFormatter(TestFormatter()))); } diff --git a/absl/synchronization/mutex_test.cc b/absl/synchronization/mutex_test.cc index 38c86912..7b13eecd 100644 --- a/absl/synchronization/mutex_test.cc +++ b/absl/synchronization/mutex_test.cc @@ -56,7 +56,7 @@ static constexpr bool kExtendedTest = false; std::unique_ptr CreatePool( int threads) { - return absl::make_unique(threads); + return std::make_unique(threads); } std::unique_ptr @@ -868,7 +868,7 @@ TEST(Mutex, LockedMutexDestructionBug) ABSL_NO_THREAD_SAFETY_ANALYSIS { for (int i = 0; i != 10; i++) { // Create, lock and destroy 10 locks. const int kNumLocks = 10; - auto mu = absl::make_unique(kNumLocks); + auto mu = std::make_unique(kNumLocks); for (int j = 0; j != kNumLocks; j++) { if ((j % 2) == 0) { mu[j].lock(); @@ -1306,7 +1306,7 @@ TEST(Mutex, DeadlockDetectorStressTest) ABSL_NO_THREAD_SAFETY_ANALYSIS { // 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(n_locks); + auto array_of_locks = std::make_unique(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/types/variant.h b/absl/types/variant.h index 6b366454..4c50bbe8 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 @@ struct ConversionVisitor { // 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 InternalReq(const Req&); +// std::variant InternalReq(const Req&); // // // name1 and name2 are convertible to name -// absl::variant ExternalReq(const Req& req) { -// return absl::ConvertVariantTo>( +// std::variant ExternalReq(const Req& req) { +// return absl::ConvertVariantTo>( // InternalReq(req)); // } template To ConvertVariantTo(Variant&& variant) { - return absl::visit(variant_internal::ConversionVisitor{}, - std::forward(variant)); + return std::visit(variant_internal::ConversionVisitor{}, + std::forward(variant)); } ABSL_NAMESPACE_END diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc index 4d7b0259..edf51e51 100644 --- a/absl/types/variant_test.cc +++ b/absl/types/variant_test.cc @@ -51,22 +51,22 @@ TEST(VariantTest, TestRvalueConversion) { std::variant v( ConvertVariantTo>( (std::variant(Convertible1())))); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); v = ConvertVariantTo>( std::variant(Convertible2())); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); } TEST(VariantTest, TestLvalueConversion) { std::variant source((Convertible1())); std::variant v( ConvertVariantTo>(source)); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); source = Convertible2(); v = ConvertVariantTo>(source); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); } TEST(VariantTest, TestMoveConversion) { @@ -77,14 +77,14 @@ TEST(VariantTest, TestMoveConversion) { Variant var( ConvertVariantTo(OtherVariant{std::make_unique(0)})); - ASSERT_TRUE(absl::holds_alternative>(var)); - ASSERT_NE(absl::get>(var), nullptr); - EXPECT_EQ(0, *absl::get>(var)); + ASSERT_TRUE(std::holds_alternative>(var)); + ASSERT_NE(std::get>(var), nullptr); + EXPECT_EQ(0, *std::get>(var)); var = ConvertVariantTo( OtherVariant(std::make_unique("foo"))); - ASSERT_TRUE(absl::holds_alternative>(var)); - EXPECT_EQ("foo", *absl::get>(var)); + ASSERT_TRUE(std::holds_alternative>(var)); + EXPECT_EQ("foo", *std::get>(var)); } TEST(VariantTest, DoesNotMoveFromLvalues) { @@ -100,47 +100,47 @@ TEST(VariantTest, DoesNotMoveFromLvalues) { // Test copy constructor Variant v2(v1); - EXPECT_EQ(absl::get>(v1), - absl::get>(v2)); + EXPECT_EQ(std::get>(v1), + std::get>(v2)); // Test copy-assignment operator v1 = std::make_shared("foo"); v2 = v1; - EXPECT_EQ(absl::get>(v1), - absl::get>(v2)); + EXPECT_EQ(std::get>(v1), + std::get>(v2)); // Test converting copy constructor OtherVariant other(std::make_shared(0)); Variant v3(ConvertVariantTo(other)); - EXPECT_EQ(absl::get>(other), - absl::get>(v3)); + EXPECT_EQ(std::get>(other), + std::get>(v3)); other = std::make_shared("foo"); v3 = ConvertVariantTo(other); - EXPECT_EQ(absl::get>(other), - absl::get>(v3)); + EXPECT_EQ(std::get>(other), + std::get>(v3)); } TEST(VariantTest, TestRvalueConversionViaConvertVariantTo) { variant v( ConvertVariantTo>( (std::variant(Convertible1())))); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); v = ConvertVariantTo>( std::variant(Convertible2())); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); } TEST(VariantTest, TestLvalueConversionViaConvertVariantTo) { variant source((Convertible1())); variant v( ConvertVariantTo>(source)); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); source = Convertible2(); v = ConvertVariantTo>(source); - ASSERT_TRUE(absl::holds_alternative(v)); + ASSERT_TRUE(std::holds_alternative(v)); } TEST(VariantTest, TestMoveConversionViaConvertVariantTo) { @@ -151,12 +151,12 @@ TEST(VariantTest, TestMoveConversionViaConvertVariantTo) { Variant var( ConvertVariantTo(OtherVariant{std::make_unique(3)})); - EXPECT_THAT(absl::get_if>(&var), + EXPECT_THAT(std::get_if>(&var), Pointee(Pointee(3))); var = ConvertVariantTo( OtherVariant(std::make_unique("foo"))); - EXPECT_THAT(absl::get_if>(&var), + EXPECT_THAT(std::get_if>(&var), Pointee(Pointee(std::string("foo")))); }