Commit d8027081 by Derek Mauro Committed by Copybara-Service

Replace usages of absl::move, absl::forward, and absl::exchange with their

std:: equivalents

PiperOrigin-RevId: 614687225
Change-Id: I07421db08ee9c221e561f42e3bf8345fb5321401
parent b97e7f35
...@@ -48,7 +48,7 @@ class FunctorClass { ...@@ -48,7 +48,7 @@ class FunctorClass {
explicit FunctorClass(Callback callback) : callback_(std::move(callback)) {} explicit FunctorClass(Callback callback) : callback_(std::move(callback)) {}
FunctorClass(FunctorClass&& other) FunctorClass(FunctorClass&& other)
: callback_(absl::exchange(other.callback_, Callback())) {} : callback_(std::exchange(other.callback_, Callback())) {}
FunctorClass(const FunctorClass&) = delete; FunctorClass(const FunctorClass&) = delete;
......
...@@ -1407,9 +1407,9 @@ class btree { ...@@ -1407,9 +1407,9 @@ class btree {
copy_or_move_values_in_order(other); copy_or_move_values_in_order(other);
} }
btree(btree &&other) noexcept btree(btree &&other) noexcept
: root_(absl::exchange(other.root_, EmptyNode())), : root_(std::exchange(other.root_, EmptyNode())),
rightmost_(std::move(other.rightmost_)), rightmost_(std::move(other.rightmost_)),
size_(absl::exchange(other.size_, 0u)) { size_(std::exchange(other.size_, 0u)) {
other.mutable_rightmost() = EmptyNode(); other.mutable_rightmost() = EmptyNode();
} }
btree(btree &&other, const allocator_type &alloc) btree(btree &&other, const allocator_type &alloc)
......
...@@ -87,10 +87,10 @@ struct Storage { ...@@ -87,10 +87,10 @@ struct Storage {
constexpr Storage() = default; constexpr Storage() = default;
template <typename V> template <typename V>
explicit constexpr Storage(absl::in_place_t, V&& v) explicit constexpr Storage(absl::in_place_t, V&& v)
: value(absl::forward<V>(v)) {} : value(std::forward<V>(v)) {}
constexpr const T& get() const& { return value; } constexpr const T& get() const& { return value; }
T& get() & { return value; } T& get() & { return value; }
constexpr const T&& get() const&& { return absl::move(*this).value; } constexpr const T&& get() const&& { return std::move(*this).value; }
T&& get() && { return std::move(*this).value; } T&& get() && { return std::move(*this).value; }
}; };
...@@ -99,12 +99,11 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage<T, I, true> : T { ...@@ -99,12 +99,11 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC Storage<T, I, true> : T {
constexpr Storage() = default; constexpr Storage() = default;
template <typename V> template <typename V>
explicit constexpr Storage(absl::in_place_t, V&& v) explicit constexpr Storage(absl::in_place_t, V&& v) : T(std::forward<V>(v)) {}
: T(absl::forward<V>(v)) {}
constexpr const T& get() const& { return *this; } constexpr const T& get() const& { return *this; }
T& get() & { return *this; } T& get() & { return *this; }
constexpr const T&& get() const&& { return absl::move(*this); } constexpr const T&& get() const&& { return std::move(*this); }
T&& get() && { return std::move(*this); } T&& get() && { return std::move(*this); }
}; };
...@@ -123,7 +122,7 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl< ...@@ -123,7 +122,7 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl<
constexpr CompressedTupleImpl() = default; constexpr CompressedTupleImpl() = default;
template <typename... Vs> template <typename... Vs>
explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
: Storage<Ts, I>(absl::in_place, absl::forward<Vs>(args))... {} : Storage<Ts, I>(absl::in_place, std::forward<Vs>(args))... {}
friend CompressedTuple<Ts...>; friend CompressedTuple<Ts...>;
}; };
...@@ -135,7 +134,7 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl< ...@@ -135,7 +134,7 @@ struct ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTupleImpl<
constexpr CompressedTupleImpl() = default; constexpr CompressedTupleImpl() = default;
template <typename... Vs> template <typename... Vs>
explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args) explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
: Storage<Ts, I, false>(absl::in_place, absl::forward<Vs>(args))... {} : Storage<Ts, I, false>(absl::in_place, std::forward<Vs>(args))... {}
friend CompressedTuple<Ts...>; friend CompressedTuple<Ts...>;
}; };
...@@ -234,8 +233,8 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple ...@@ -234,8 +233,8 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
bool> = true> bool> = true>
explicit constexpr CompressedTuple(First&& first, Vs&&... base) explicit constexpr CompressedTuple(First&& first, Vs&&... base)
: CompressedTuple::CompressedTupleImpl(absl::in_place, : CompressedTuple::CompressedTupleImpl(absl::in_place,
absl::forward<First>(first), std::forward<First>(first),
absl::forward<Vs>(base)...) {} std::forward<Vs>(base)...) {}
template <int I> template <int I>
ElemT<I>& get() & { ElemT<I>& get() & {
...@@ -254,7 +253,7 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple ...@@ -254,7 +253,7 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
template <int I> template <int I>
constexpr const ElemT<I>&& get() const&& { constexpr const ElemT<I>&& get() const&& {
return absl::move(*this).StorageT<I>::get(); return std::move(*this).StorageT<I>::get();
} }
}; };
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <utility>
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
...@@ -384,8 +385,8 @@ TEST(CompressedTupleTest, Constexpr) { ...@@ -384,8 +385,8 @@ TEST(CompressedTupleTest, Constexpr) {
#if defined(__clang__) #if defined(__clang__)
// An apparent bug in earlier versions of gcc claims these are ambiguous. // An apparent bug in earlier versions of gcc claims these are ambiguous.
constexpr int x2m = absl::move(x.get<2>()).get<0>(); constexpr int x2m = std::move(x.get<2>()).get<0>();
constexpr CallType x3m = absl::move(x).get<3>().value(); constexpr CallType x3m = std::move(x).get<3>().value();
EXPECT_EQ(x2m, 5); EXPECT_EQ(x2m, 5);
EXPECT_EQ(x3m, CallType::kConstMove); EXPECT_EQ(x3m, CallType::kConstMove);
#endif #endif
......
...@@ -706,7 +706,7 @@ class Layout : public internal_layout::LayoutType<sizeof...(Ts), Ts...> { ...@@ -706,7 +706,7 @@ class Layout : public internal_layout::LayoutType<sizeof...(Ts), Ts...> {
template <class... Sizes> template <class... Sizes>
static constexpr PartialType<sizeof...(Sizes)> Partial(Sizes&&... sizes) { static constexpr PartialType<sizeof...(Sizes)> Partial(Sizes&&... sizes) {
static_assert(sizeof...(Sizes) <= sizeof...(Ts), ""); static_assert(sizeof...(Sizes) <= sizeof...(Ts), "");
return PartialType<sizeof...(Sizes)>(absl::forward<Sizes>(sizes)...); return PartialType<sizeof...(Sizes)>(std::forward<Sizes>(sizes)...);
} }
// Creates a layout with the sizes of all arrays specified. If you know // Creates a layout with the sizes of all arrays specified. If you know
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <functional> // For std::bind_front. #include <functional> // For std::bind_front.
#endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L #endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L
#include <utility>
#include "absl/functional/internal/front_binder.h" #include "absl/functional/internal/front_binder.h"
#include "absl/utility/utility.h" #include "absl/utility/utility.h"
...@@ -182,8 +184,7 @@ template <class F, class... BoundArgs> ...@@ -182,8 +184,7 @@ template <class F, class... BoundArgs>
constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front( constexpr functional_internal::bind_front_t<F, BoundArgs...> bind_front(
F&& func, BoundArgs&&... args) { F&& func, BoundArgs&&... args) {
return functional_internal::bind_front_t<F, BoundArgs...>( return functional_internal::bind_front_t<F, BoundArgs...>(
absl::in_place, absl::forward<F>(func), absl::in_place, std::forward<F>(func), std::forward<BoundArgs>(args)...);
absl::forward<BoundArgs>(args)...);
} }
#endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L #endif // defined(__cpp_lib_bind_front) && __cpp_lib_bind_front >= 201907L
......
...@@ -34,8 +34,8 @@ namespace functional_internal { ...@@ -34,8 +34,8 @@ namespace functional_internal {
template <class R, class Tuple, size_t... Idx, class... Args> template <class R, class Tuple, size_t... Idx, class... Args>
R Apply(Tuple&& bound, absl::index_sequence<Idx...>, Args&&... free) { R Apply(Tuple&& bound, absl::index_sequence<Idx...>, Args&&... free) {
return base_internal::invoke( return base_internal::invoke(
absl::forward<Tuple>(bound).template get<Idx>()..., std::forward<Tuple>(bound).template get<Idx>()...,
absl::forward<Args>(free)...); std::forward<Args>(free)...);
} }
template <class F, class... BoundArgs> template <class F, class... BoundArgs>
...@@ -48,13 +48,13 @@ class FrontBinder { ...@@ -48,13 +48,13 @@ class FrontBinder {
public: public:
template <class... Ts> template <class... Ts>
constexpr explicit FrontBinder(absl::in_place_t, Ts&&... ts) constexpr explicit FrontBinder(absl::in_place_t, Ts&&... ts)
: bound_args_(absl::forward<Ts>(ts)...) {} : bound_args_(std::forward<Ts>(ts)...) {}
template <class... FreeArgs, class R = base_internal::invoke_result_t< template <class... FreeArgs, class R = base_internal::invoke_result_t<
F&, BoundArgs&..., FreeArgs&&...>> F&, BoundArgs&..., FreeArgs&&...>>
R operator()(FreeArgs&&... free_args) & { R operator()(FreeArgs&&... free_args) & {
return functional_internal::Apply<R>(bound_args_, Idx(), return functional_internal::Apply<R>(bound_args_, Idx(),
absl::forward<FreeArgs>(free_args)...); std::forward<FreeArgs>(free_args)...);
} }
template <class... FreeArgs, template <class... FreeArgs,
...@@ -62,7 +62,7 @@ class FrontBinder { ...@@ -62,7 +62,7 @@ class FrontBinder {
const F&, const BoundArgs&..., FreeArgs&&...>> const F&, const BoundArgs&..., FreeArgs&&...>>
R operator()(FreeArgs&&... free_args) const& { R operator()(FreeArgs&&... free_args) const& {
return functional_internal::Apply<R>(bound_args_, Idx(), return functional_internal::Apply<R>(bound_args_, Idx(),
absl::forward<FreeArgs>(free_args)...); std::forward<FreeArgs>(free_args)...);
} }
template <class... FreeArgs, class R = base_internal::invoke_result_t< template <class... FreeArgs, class R = base_internal::invoke_result_t<
...@@ -70,8 +70,8 @@ class FrontBinder { ...@@ -70,8 +70,8 @@ class FrontBinder {
R operator()(FreeArgs&&... free_args) && { R operator()(FreeArgs&&... free_args) && {
// This overload is called when *this is an rvalue. If some of the bound // 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. // arguments are stored by value or rvalue reference, we move them.
return functional_internal::Apply<R>(absl::move(bound_args_), Idx(), return functional_internal::Apply<R>(std::move(bound_args_), Idx(),
absl::forward<FreeArgs>(free_args)...); std::forward<FreeArgs>(free_args)...);
} }
template <class... FreeArgs, template <class... FreeArgs,
...@@ -80,8 +80,8 @@ class FrontBinder { ...@@ -80,8 +80,8 @@ class FrontBinder {
R operator()(FreeArgs&&... free_args) const&& { R operator()(FreeArgs&&... free_args) const&& {
// This overload is called when *this is an rvalue. If some of the bound // 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. // arguments are stored by value or rvalue reference, we move them.
return functional_internal::Apply<R>(absl::move(bound_args_), Idx(), return functional_internal::Apply<R>(std::move(bound_args_), Idx(),
absl::forward<FreeArgs>(free_args)...); std::forward<FreeArgs>(free_args)...);
} }
}; };
......
...@@ -81,7 +81,7 @@ class optional_data_dtor_base { ...@@ -81,7 +81,7 @@ class optional_data_dtor_base {
template <typename... Args> template <typename... Args>
constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args) constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args)
: engaged_(true), data_(absl::forward<Args>(args)...) {} : engaged_(true), data_(std::forward<Args>(args)...) {}
~optional_data_dtor_base() { destruct(); } ~optional_data_dtor_base() { destruct(); }
}; };
...@@ -110,7 +110,7 @@ class optional_data_dtor_base<T, true> { ...@@ -110,7 +110,7 @@ class optional_data_dtor_base<T, true> {
template <typename... Args> template <typename... Args>
constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args) constexpr explicit optional_data_dtor_base(in_place_t, Args&&... args)
: engaged_(true), data_(absl::forward<Args>(args)...) {} : engaged_(true), data_(std::forward<Args>(args)...) {}
}; };
template <typename T> template <typename T>
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdexcept> #include <stdexcept>
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
#include <utility>
#include "absl/base/config.h" #include "absl/base/config.h"
#include "absl/base/internal/identity.h" #include "absl/base/internal/identity.h"
...@@ -214,7 +215,7 @@ constexpr ReturnType call_with_indices(FunctionObject&& function) { ...@@ -214,7 +215,7 @@ constexpr ReturnType call_with_indices(FunctionObject&& function) {
std::is_same<ReturnType, decltype(std::declval<FunctionObject>()( std::is_same<ReturnType, decltype(std::declval<FunctionObject>()(
SizeT<Indices>()...))>::value, SizeT<Indices>()...))>::value,
"Not all visitation overloads have the same return type."); "Not all visitation overloads have the same return type.");
return absl::forward<FunctionObject>(function)(SizeT<Indices>()...); return std::forward<FunctionObject>(function)(SizeT<Indices>()...);
} }
template <class ReturnType, class FunctionObject, std::size_t... BoundIndices> template <class ReturnType, class FunctionObject, std::size_t... BoundIndices>
...@@ -284,7 +285,7 @@ struct UnreachableSwitchCase { ...@@ -284,7 +285,7 @@ struct UnreachableSwitchCase {
assert(false); // NOLINT assert(false); // NOLINT
// Hack to silence potential no return warning -- cause an infinite loop. // Hack to silence potential no return warning -- cause an infinite loop.
return Run(absl::forward<Op>(op)); return Run(std::forward<Op>(op));
#endif // Checks for __builtin_unreachable #endif // Checks for __builtin_unreachable
} }
}; };
...@@ -292,7 +293,7 @@ struct UnreachableSwitchCase { ...@@ -292,7 +293,7 @@ struct UnreachableSwitchCase {
template <class Op, std::size_t I> template <class Op, std::size_t I>
struct ReachableSwitchCase { struct ReachableSwitchCase {
static VisitIndicesResultT<Op, std::size_t> Run(Op&& op) { static VisitIndicesResultT<Op, std::size_t> Run(Op&& op) {
return absl::base_internal::invoke(absl::forward<Op>(op), SizeT<I>()); return absl::base_internal::invoke(std::forward<Op>(op), SizeT<I>());
} }
}; };
...@@ -357,74 +358,74 @@ struct VisitIndicesSwitch { ...@@ -357,74 +358,74 @@ struct VisitIndicesSwitch {
static VisitIndicesResultT<Op, std::size_t> Run(Op&& op, std::size_t i) { static VisitIndicesResultT<Op, std::size_t> Run(Op&& op, std::size_t i) {
switch (i) { switch (i) {
case 0: case 0:
return PickCase<Op, 0, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 0, EndIndex>::Run(std::forward<Op>(op));
case 1: case 1:
return PickCase<Op, 1, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 1, EndIndex>::Run(std::forward<Op>(op));
case 2: case 2:
return PickCase<Op, 2, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 2, EndIndex>::Run(std::forward<Op>(op));
case 3: case 3:
return PickCase<Op, 3, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 3, EndIndex>::Run(std::forward<Op>(op));
case 4: case 4:
return PickCase<Op, 4, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 4, EndIndex>::Run(std::forward<Op>(op));
case 5: case 5:
return PickCase<Op, 5, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 5, EndIndex>::Run(std::forward<Op>(op));
case 6: case 6:
return PickCase<Op, 6, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 6, EndIndex>::Run(std::forward<Op>(op));
case 7: case 7:
return PickCase<Op, 7, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 7, EndIndex>::Run(std::forward<Op>(op));
case 8: case 8:
return PickCase<Op, 8, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 8, EndIndex>::Run(std::forward<Op>(op));
case 9: case 9:
return PickCase<Op, 9, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 9, EndIndex>::Run(std::forward<Op>(op));
case 10: case 10:
return PickCase<Op, 10, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 10, EndIndex>::Run(std::forward<Op>(op));
case 11: case 11:
return PickCase<Op, 11, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 11, EndIndex>::Run(std::forward<Op>(op));
case 12: case 12:
return PickCase<Op, 12, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 12, EndIndex>::Run(std::forward<Op>(op));
case 13: case 13:
return PickCase<Op, 13, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 13, EndIndex>::Run(std::forward<Op>(op));
case 14: case 14:
return PickCase<Op, 14, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 14, EndIndex>::Run(std::forward<Op>(op));
case 15: case 15:
return PickCase<Op, 15, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 15, EndIndex>::Run(std::forward<Op>(op));
case 16: case 16:
return PickCase<Op, 16, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 16, EndIndex>::Run(std::forward<Op>(op));
case 17: case 17:
return PickCase<Op, 17, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 17, EndIndex>::Run(std::forward<Op>(op));
case 18: case 18:
return PickCase<Op, 18, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 18, EndIndex>::Run(std::forward<Op>(op));
case 19: case 19:
return PickCase<Op, 19, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 19, EndIndex>::Run(std::forward<Op>(op));
case 20: case 20:
return PickCase<Op, 20, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 20, EndIndex>::Run(std::forward<Op>(op));
case 21: case 21:
return PickCase<Op, 21, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 21, EndIndex>::Run(std::forward<Op>(op));
case 22: case 22:
return PickCase<Op, 22, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 22, EndIndex>::Run(std::forward<Op>(op));
case 23: case 23:
return PickCase<Op, 23, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 23, EndIndex>::Run(std::forward<Op>(op));
case 24: case 24:
return PickCase<Op, 24, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 24, EndIndex>::Run(std::forward<Op>(op));
case 25: case 25:
return PickCase<Op, 25, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 25, EndIndex>::Run(std::forward<Op>(op));
case 26: case 26:
return PickCase<Op, 26, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 26, EndIndex>::Run(std::forward<Op>(op));
case 27: case 27:
return PickCase<Op, 27, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 27, EndIndex>::Run(std::forward<Op>(op));
case 28: case 28:
return PickCase<Op, 28, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 28, EndIndex>::Run(std::forward<Op>(op));
case 29: case 29:
return PickCase<Op, 29, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 29, EndIndex>::Run(std::forward<Op>(op));
case 30: case 30:
return PickCase<Op, 30, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 30, EndIndex>::Run(std::forward<Op>(op));
case 31: case 31:
return PickCase<Op, 31, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 31, EndIndex>::Run(std::forward<Op>(op));
case 32: case 32:
return PickCase<Op, 32, EndIndex>::Run(absl::forward<Op>(op)); return PickCase<Op, 32, EndIndex>::Run(std::forward<Op>(op));
default: default:
ABSL_ASSERT(i == variant_npos); ABSL_ASSERT(i == variant_npos);
return absl::base_internal::invoke(absl::forward<Op>(op), NPos()); return absl::base_internal::invoke(std::forward<Op>(op), NPos());
} }
} }
}; };
...@@ -437,7 +438,7 @@ struct VisitIndicesFallback { ...@@ -437,7 +438,7 @@ struct VisitIndicesFallback {
MakeVisitationMatrix<VisitIndicesResultT<Op, SizeT...>, Op, MakeVisitationMatrix<VisitIndicesResultT<Op, SizeT...>, Op,
index_sequence<(EndIndices + 1)...>, index_sequence<(EndIndices + 1)...>,
index_sequence<>>::Run(), index_sequence<>>::Run(),
(indices + 1)...)(absl::forward<Op>(op)); (indices + 1)...)(std::forward<Op>(op));
} }
}; };
...@@ -489,7 +490,7 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> { ...@@ -489,7 +490,7 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
VisitIndicesResultT<Op, decltype(EndIndices)...> operator()( VisitIndicesResultT<Op, decltype(EndIndices)...> operator()(
SizeT<I> /*index*/) && { SizeT<I> /*index*/) && {
return base_internal::invoke( return base_internal::invoke(
absl::forward<Op>(op), std::forward<Op>(op),
SizeT<UnflattenIndex<I, N, (EndIndices + 1)...>::value - SizeT<UnflattenIndex<I, N, (EndIndices + 1)...>::value -
std::size_t{1}>()...); std::size_t{1}>()...);
} }
...@@ -501,7 +502,7 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> { ...@@ -501,7 +502,7 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
static VisitIndicesResultT<Op, decltype(EndIndices)...> Run(Op&& op, static VisitIndicesResultT<Op, decltype(EndIndices)...> Run(Op&& op,
SizeType... i) { SizeType... i) {
return VisitIndicesSwitch<NumCasesOfSwitch<EndIndices...>::value>::Run( return VisitIndicesSwitch<NumCasesOfSwitch<EndIndices...>::value>::Run(
FlattenedOp<Op>{absl::forward<Op>(op)}, FlattenedOp<Op>{std::forward<Op>(op)},
FlattenIndices<(EndIndices + std::size_t{1})...>::Run( FlattenIndices<(EndIndices + std::size_t{1})...>::Run(
(i + std::size_t{1})...)); (i + std::size_t{1})...));
} }
...@@ -612,7 +613,7 @@ struct VariantCoreAccess { ...@@ -612,7 +613,7 @@ struct VariantCoreAccess {
TypedThrowBadVariantAccess<VariantAccessResult<I, Variant>>(); TypedThrowBadVariantAccess<VariantAccessResult<I, Variant>>();
} }
return Access<I>(absl::forward<Variant>(self)); return Access<I>(std::forward<Variant>(self));
} }
// The implementation of the move-assignment operation for a variant. // The implementation of the move-assignment operation for a variant.
...@@ -684,7 +685,7 @@ struct VariantCoreAccess { ...@@ -684,7 +685,7 @@ struct VariantCoreAccess {
void operator()(SizeT<NewIndex::value> /*old_i*/ void operator()(SizeT<NewIndex::value> /*old_i*/
) const { ) const {
Access<NewIndex::value>(*left) = absl::forward<QualifiedNew>(other); Access<NewIndex::value>(*left) = std::forward<QualifiedNew>(other);
} }
template <std::size_t OldIndex> template <std::size_t OldIndex>
...@@ -695,13 +696,13 @@ struct VariantCoreAccess { ...@@ -695,13 +696,13 @@ struct VariantCoreAccess {
if (std::is_nothrow_constructible<New, QualifiedNew>::value || if (std::is_nothrow_constructible<New, QualifiedNew>::value ||
!std::is_nothrow_move_constructible<New>::value) { !std::is_nothrow_move_constructible<New>::value) {
left->template emplace<NewIndex::value>( left->template emplace<NewIndex::value>(
absl::forward<QualifiedNew>(other)); std::forward<QualifiedNew>(other));
} else { } else {
// the standard says "equivalent to // the standard says "equivalent to
// operator=(variant(std::forward<T>(t)))", but we use `emplace` here // operator=(variant(std::forward<T>(t)))", but we use `emplace` here
// because the variant's move assignment operator could be deleted. // because the variant's move assignment operator could be deleted.
left->template emplace<NewIndex::value>( left->template emplace<NewIndex::value>(
New(absl::forward<QualifiedNew>(other))); New(std::forward<QualifiedNew>(other)));
} }
} }
...@@ -712,7 +713,7 @@ struct VariantCoreAccess { ...@@ -712,7 +713,7 @@ struct VariantCoreAccess {
template <class Left, class QualifiedNew> template <class Left, class QualifiedNew>
static ConversionAssignVisitor<Left, QualifiedNew> static ConversionAssignVisitor<Left, QualifiedNew>
MakeConversionAssignVisitor(Left* left, QualifiedNew&& qual) { MakeConversionAssignVisitor(Left* left, QualifiedNew&& qual) {
return {left, absl::forward<QualifiedNew>(qual)}; return {left, std::forward<QualifiedNew>(qual)};
} }
// Backend for operations for `emplace()` which destructs `*self` then // Backend for operations for `emplace()` which destructs `*self` then
...@@ -723,7 +724,7 @@ struct VariantCoreAccess { ...@@ -723,7 +724,7 @@ struct VariantCoreAccess {
Destroy(*self); Destroy(*self);
using New = typename absl::variant_alternative<NewIndex, Self>::type; using New = typename absl::variant_alternative<NewIndex, Self>::type;
New* const result = ::new (static_cast<void*>(&self->state_)) New* const result = ::new (static_cast<void*>(&self->state_))
New(absl::forward<Args>(args)...); New(std::forward<Args>(args)...);
self->index_ = NewIndex; self->index_ = NewIndex;
return *result; return *result;
} }
...@@ -919,9 +920,9 @@ struct PerformVisitation { ...@@ -919,9 +920,9 @@ struct PerformVisitation {
Is, QualifiedVariants>...)>>::value, Is, QualifiedVariants>...)>>::value,
"All visitation overloads must have the same return type."); "All visitation overloads must have the same return type.");
return absl::base_internal::invoke( return absl::base_internal::invoke(
absl::forward<Op>(op), std::forward<Op>(op),
VariantCoreAccess::Access<Is>( VariantCoreAccess::Access<Is>(
absl::forward<QualifiedVariants>(std::get<TupIs>(variant_tup)))...); std::forward<QualifiedVariants>(std::get<TupIs>(variant_tup)))...);
} }
template <std::size_t... TupIs, std::size_t... Is> template <std::size_t... TupIs, std::size_t... Is>
...@@ -969,11 +970,11 @@ union Union<Head, Tail...> { ...@@ -969,11 +970,11 @@ union Union<Head, Tail...> {
template <class... P> template <class... P>
explicit constexpr Union(EmplaceTag<0>, P&&... args) explicit constexpr Union(EmplaceTag<0>, P&&... args)
: head(absl::forward<P>(args)...) {} : head(std::forward<P>(args)...) {}
template <std::size_t I, class... P> template <std::size_t I, class... P>
explicit constexpr Union(EmplaceTag<I>, P&&... args) explicit constexpr Union(EmplaceTag<I>, P&&... args)
: tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {} : tail(EmplaceTag<I - 1>{}, std::forward<P>(args)...) {}
Head head; Head head;
TailUnion tail; TailUnion tail;
...@@ -1001,11 +1002,11 @@ union DestructibleUnionImpl<Head, Tail...> { ...@@ -1001,11 +1002,11 @@ union DestructibleUnionImpl<Head, Tail...> {
template <class... P> template <class... P>
explicit constexpr DestructibleUnionImpl(EmplaceTag<0>, P&&... args) explicit constexpr DestructibleUnionImpl(EmplaceTag<0>, P&&... args)
: head(absl::forward<P>(args)...) {} : head(std::forward<P>(args)...) {}
template <std::size_t I, class... P> template <std::size_t I, class... P>
explicit constexpr DestructibleUnionImpl(EmplaceTag<I>, P&&... args) explicit constexpr DestructibleUnionImpl(EmplaceTag<I>, P&&... args)
: tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {} : tail(EmplaceTag<I - 1>{}, std::forward<P>(args)...) {}
~DestructibleUnionImpl() {} ~DestructibleUnionImpl() {}
...@@ -1036,7 +1037,7 @@ class VariantStateBase { ...@@ -1036,7 +1037,7 @@ class VariantStateBase {
template <std::size_t I, class... P> template <std::size_t I, class... P>
explicit constexpr VariantStateBase(EmplaceTag<I> tag, P&&... args) explicit constexpr VariantStateBase(EmplaceTag<I> tag, P&&... args)
: state_(tag, absl::forward<P>(args)...), index_(I) {} : state_(tag, std::forward<P>(args)...), index_(I) {}
explicit constexpr VariantStateBase(NoopConstructorTag) explicit constexpr VariantStateBase(NoopConstructorTag)
: state_(NoopConstructorTag()), index_(variant_npos) {} : state_(NoopConstructorTag()), index_(variant_npos) {}
...@@ -1321,7 +1322,7 @@ class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor<T...> { ...@@ -1321,7 +1322,7 @@ class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor<T...> {
using Alternative = using Alternative =
typename absl::variant_alternative<I, variant<T...>>::type; typename absl::variant_alternative<I, variant<T...>>::type;
::new (static_cast<void*>(&self->state_)) Alternative( ::new (static_cast<void*>(&self->state_)) Alternative(
variant_internal::AccessUnion(absl::move(other->state_), i)); variant_internal::AccessUnion(std::move(other->state_), i));
} }
void operator()(SizeT<absl::variant_npos> /*i*/) const {} void operator()(SizeT<absl::variant_npos> /*i*/) const {}
......
...@@ -151,7 +151,7 @@ class optional : private optional_internal::optional_data<T>, ...@@ -151,7 +151,7 @@ class optional : private optional_internal::optional_data<T>,
std::is_same<InPlaceT, in_place_t>, std::is_same<InPlaceT, in_place_t>,
std::is_constructible<T, Args&&...> >::value>* = nullptr> std::is_constructible<T, Args&&...> >::value>* = nullptr>
constexpr explicit optional(InPlaceT, Args&&... args) constexpr explicit optional(InPlaceT, Args&&... args)
: data_base(in_place_t(), absl::forward<Args>(args)...) {} : data_base(in_place_t(), std::forward<Args>(args)...) {}
// Constructs a non-empty `optional` direct-initialized value of type `T` from // Constructs a non-empty `optional` direct-initialized value of type `T` from
// the arguments of an initializer_list and `std::forward<Args>(args)...`. // the arguments of an initializer_list and `std::forward<Args>(args)...`.
...@@ -162,8 +162,7 @@ class optional : private optional_internal::optional_data<T>, ...@@ -162,8 +162,7 @@ class optional : private optional_internal::optional_data<T>,
T, std::initializer_list<U>&, Args&&...>::value>::type> T, std::initializer_list<U>&, Args&&...>::value>::type>
constexpr explicit optional(in_place_t, std::initializer_list<U> il, constexpr explicit optional(in_place_t, std::initializer_list<U> il,
Args&&... args) Args&&... args)
: data_base(in_place_t(), il, absl::forward<Args>(args)...) { : data_base(in_place_t(), il, std::forward<Args>(args)...) {}
}
// Value constructor (implicit) // Value constructor (implicit)
template < template <
...@@ -176,21 +175,21 @@ class optional : private optional_internal::optional_data<T>, ...@@ -176,21 +175,21 @@ class optional : private optional_internal::optional_data<T>,
std::is_convertible<U&&, T>, std::is_convertible<U&&, T>,
std::is_constructible<T, U&&> >::value, std::is_constructible<T, U&&> >::value,
bool>::type = false> bool>::type = false>
constexpr optional(U&& v) : data_base(in_place_t(), absl::forward<U>(v)) {} constexpr optional(U&& v) : data_base(in_place_t(), std::forward<U>(v)) {}
// Value constructor (explicit) // Value constructor (explicit)
template < template <
typename U = T, typename U = T,
typename std::enable_if< typename std::enable_if<
absl::conjunction<absl::negation<std::is_same< absl::conjunction<absl::negation<std::is_same<
in_place_t, typename std::decay<U>::type>>, in_place_t, typename std::decay<U>::type> >,
absl::negation<std::is_same< absl::negation<std::is_same<
optional<T>, typename std::decay<U>::type>>, optional<T>, typename std::decay<U>::type> >,
absl::negation<std::is_convertible<U&&, T>>, absl::negation<std::is_convertible<U&&, T> >,
std::is_constructible<T, U&&>>::value, std::is_constructible<T, U&&> >::value,
bool>::type = false> bool>::type = false>
explicit constexpr optional(U&& v) explicit constexpr optional(U&& v)
: data_base(in_place_t(), absl::forward<U>(v)) {} : data_base(in_place_t(), std::forward<U>(v)) {}
// Converting copy constructor (implicit) // Converting copy constructor (implicit)
template <typename U, template <typename U,
...@@ -437,7 +436,7 @@ class optional : private optional_internal::optional_data<T>, ...@@ -437,7 +436,7 @@ class optional : private optional_internal::optional_data<T>,
return reference(); return reference();
} }
constexpr const T&& operator*() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND { constexpr const T&& operator*() const&& ABSL_ATTRIBUTE_LIFETIME_BOUND {
return ABSL_HARDENING_ASSERT(this->engaged_), absl::move(reference()); return ABSL_HARDENING_ASSERT(this->engaged_), std::move(reference());
} }
T&& operator*() && ABSL_ATTRIBUTE_LIFETIME_BOUND { T&& operator*() && ABSL_ATTRIBUTE_LIFETIME_BOUND {
ABSL_HARDENING_ASSERT(this->engaged_); ABSL_HARDENING_ASSERT(this->engaged_);
...@@ -492,7 +491,7 @@ class optional : private optional_internal::optional_data<T>, ...@@ -492,7 +491,7 @@ class optional : private optional_internal::optional_data<T>,
} }
constexpr const T&& value() constexpr const T&& value()
const&& ABSL_ATTRIBUTE_LIFETIME_BOUND { // NOLINT(build/c++11) const&& ABSL_ATTRIBUTE_LIFETIME_BOUND { // NOLINT(build/c++11)
return absl::move( return std::move(
static_cast<bool>(*this) static_cast<bool>(*this)
? reference() ? reference()
: (optional_internal::throw_bad_optional_access(), reference())); : (optional_internal::throw_bad_optional_access(), reference()));
...@@ -511,9 +510,8 @@ class optional : private optional_internal::optional_data<T>, ...@@ -511,9 +510,8 @@ class optional : private optional_internal::optional_data<T>,
"optional<T>::value_or: T must be copy constructible"); "optional<T>::value_or: T must be copy constructible");
static_assert(std::is_convertible<U&&, value_type>::value, static_assert(std::is_convertible<U&&, value_type>::value,
"optional<T>::value_or: U must be convertible to T"); "optional<T>::value_or: U must be convertible to T");
return static_cast<bool>(*this) return static_cast<bool>(*this) ? **this
? **this : static_cast<T>(std::forward<U>(v));
: static_cast<T>(absl::forward<U>(v));
} }
template <typename U> template <typename U>
T value_or(U&& v) && { // NOLINT(build/c++11) T value_or(U&& v) && { // NOLINT(build/c++11)
...@@ -573,19 +571,18 @@ void swap(optional<T>& a, optional<T>& b) noexcept(noexcept(a.swap(b))) { ...@@ -573,19 +571,18 @@ void swap(optional<T>& a, optional<T>& b) noexcept(noexcept(a.swap(b))) {
// static_assert(opt.value() == 1, ""); // static_assert(opt.value() == 1, "");
template <typename T> template <typename T>
constexpr optional<typename std::decay<T>::type> make_optional(T&& v) { constexpr optional<typename std::decay<T>::type> make_optional(T&& v) {
return optional<typename std::decay<T>::type>(absl::forward<T>(v)); return optional<typename std::decay<T>::type>(std::forward<T>(v));
} }
template <typename T, typename... Args> template <typename T, typename... Args>
constexpr optional<T> make_optional(Args&&... args) { constexpr optional<T> make_optional(Args&&... args) {
return optional<T>(in_place_t(), absl::forward<Args>(args)...); return optional<T>(in_place_t(), std::forward<Args>(args)...);
} }
template <typename T, typename U, typename... Args> template <typename T, typename U, typename... Args>
constexpr optional<T> make_optional(std::initializer_list<U> il, constexpr optional<T> make_optional(std::initializer_list<U> il,
Args&&... args) { Args&&... args) {
return optional<T>(in_place_t(), il, return optional<T>(in_place_t(), il, std::forward<Args>(args)...);
absl::forward<Args>(args)...);
} }
// Relational operators [optional.relops] // Relational operators [optional.relops]
......
...@@ -303,11 +303,10 @@ constexpr T& get(variant<Types...>& v) { // NOLINT ...@@ -303,11 +303,10 @@ constexpr T& get(variant<Types...>& v) { // NOLINT
} }
// Overload for getting a variant's rvalue by type. // Overload for getting a variant's rvalue by type.
// Note: `absl::move()` is required to allow use of constexpr in C++11.
template <class T, class... Types> template <class T, class... Types>
constexpr T&& get(variant<Types...>&& v) { constexpr T&& get(variant<Types...>&& v) {
return variant_internal::VariantCoreAccess::CheckedAccess< return variant_internal::VariantCoreAccess::CheckedAccess<
variant_internal::IndexOf<T, Types...>::value>(absl::move(v)); variant_internal::IndexOf<T, Types...>::value>(std::move(v));
} }
// Overload for getting a variant's const lvalue by type. // Overload for getting a variant's const lvalue by type.
...@@ -318,11 +317,10 @@ constexpr const T& get(const variant<Types...>& v) { ...@@ -318,11 +317,10 @@ constexpr const T& get(const variant<Types...>& v) {
} }
// Overload for getting a variant's const rvalue by type. // Overload for getting a variant's const rvalue by type.
// Note: `absl::move()` is required to allow use of constexpr in C++11.
template <class T, class... Types> template <class T, class... Types>
constexpr const T&& get(const variant<Types...>&& v) { constexpr const T&& get(const variant<Types...>&& v) {
return variant_internal::VariantCoreAccess::CheckedAccess< return variant_internal::VariantCoreAccess::CheckedAccess<
variant_internal::IndexOf<T, Types...>::value>(absl::move(v)); variant_internal::IndexOf<T, Types...>::value>(std::move(v));
} }
// Overload for getting a variant's lvalue by index. // Overload for getting a variant's lvalue by index.
...@@ -333,11 +331,10 @@ constexpr variant_alternative_t<I, variant<Types...>>& get( ...@@ -333,11 +331,10 @@ constexpr variant_alternative_t<I, variant<Types...>>& get(
} }
// Overload for getting a variant's rvalue by index. // Overload for getting a variant's rvalue by index.
// Note: `absl::move()` is required to allow use of constexpr in C++11.
template <std::size_t I, class... Types> template <std::size_t I, class... Types>
constexpr variant_alternative_t<I, variant<Types...>>&& get( constexpr variant_alternative_t<I, variant<Types...>>&& get(
variant<Types...>&& v) { variant<Types...>&& v) {
return variant_internal::VariantCoreAccess::CheckedAccess<I>(absl::move(v)); return variant_internal::VariantCoreAccess::CheckedAccess<I>(std::move(v));
} }
// Overload for getting a variant's const lvalue by index. // Overload for getting a variant's const lvalue by index.
...@@ -348,11 +345,10 @@ constexpr const variant_alternative_t<I, variant<Types...>>& get( ...@@ -348,11 +345,10 @@ constexpr const variant_alternative_t<I, variant<Types...>>& get(
} }
// Overload for getting a variant's const rvalue by index. // Overload for getting a variant's const rvalue by index.
// Note: `absl::move()` is required to allow use of constexpr in C++11.
template <std::size_t I, class... Types> template <std::size_t I, class... Types>
constexpr const variant_alternative_t<I, variant<Types...>>&& get( constexpr const variant_alternative_t<I, variant<Types...>>&& get(
const variant<Types...>&& v) { const variant<Types...>&& v) {
return variant_internal::VariantCoreAccess::CheckedAccess<I>(absl::move(v)); return variant_internal::VariantCoreAccess::CheckedAccess<I>(std::move(v));
} }
// get_if() // get_if()
...@@ -432,8 +428,8 @@ variant_internal::VisitResult<Visitor, Variants...> visit(Visitor&& vis, ...@@ -432,8 +428,8 @@ variant_internal::VisitResult<Visitor, Variants...> visit(Visitor&& vis,
return variant_internal:: return variant_internal::
VisitIndices<variant_size<absl::decay_t<Variants> >::value...>::Run( VisitIndices<variant_size<absl::decay_t<Variants> >::value...>::Run(
variant_internal::PerformVisitation<Visitor, Variants...>{ variant_internal::PerformVisitation<Visitor, Variants...>{
std::forward_as_tuple(absl::forward<Variants>(vars)...), std::forward_as_tuple(std::forward<Variants>(vars)...),
absl::forward<Visitor>(vis)}, std::forward<Visitor>(vis)},
vars.index()...); vars.index()...);
} }
...@@ -504,13 +500,12 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -504,13 +500,12 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
class T, class T,
std::size_t I = std::enable_if< std::size_t I = std::enable_if<
variant_internal::IsNeitherSelfNorInPlace<variant, variant_internal::IsNeitherSelfNorInPlace<variant,
absl::decay_t<T>>::value, absl::decay_t<T> >::value,
variant_internal::IndexOfConstructedType<variant, T>>::type::value, variant_internal::IndexOfConstructedType<variant, T> >::type::value,
class Tj = absl::variant_alternative_t<I, variant>, class Tj = absl::variant_alternative_t<I, variant>,
absl::enable_if_t<std::is_constructible<Tj, T>::value>* = absl::enable_if_t<std::is_constructible<Tj, T>::value>* = nullptr>
nullptr>
constexpr variant(T&& t) noexcept(std::is_nothrow_constructible<Tj, T>::value) constexpr variant(T&& t) noexcept(std::is_nothrow_constructible<Tj, T>::value)
: Base(variant_internal::EmplaceTag<I>(), absl::forward<T>(t)) {} : Base(variant_internal::EmplaceTag<I>(), std::forward<T>(t)) {}
// Constructs a variant of an alternative type from the arguments through // Constructs a variant of an alternative type from the arguments through
// direct-initialization. // direct-initialization.
...@@ -524,7 +519,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -524,7 +519,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
constexpr explicit variant(in_place_type_t<T>, Args&&... args) constexpr explicit variant(in_place_type_t<T>, Args&&... args)
: Base(variant_internal::EmplaceTag< : Base(variant_internal::EmplaceTag<
variant_internal::UnambiguousIndexOf<variant, T>::value>(), variant_internal::UnambiguousIndexOf<variant, T>::value>(),
absl::forward<Args>(args)...) {} std::forward<Args>(args)...) {}
// Constructs a variant of an alternative type from an initializer list // Constructs a variant of an alternative type from an initializer list
// and other arguments through direct-initialization. // and other arguments through direct-initialization.
...@@ -539,7 +534,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -539,7 +534,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
Args&&... args) Args&&... args)
: Base(variant_internal::EmplaceTag< : Base(variant_internal::EmplaceTag<
variant_internal::UnambiguousIndexOf<variant, T>::value>(), variant_internal::UnambiguousIndexOf<variant, T>::value>(),
il, absl::forward<Args>(args)...) {} il, std::forward<Args>(args)...) {}
// Constructs a variant of an alternative type from a provided index, // Constructs a variant of an alternative type from a provided index,
// through value-initialization using the provided forwarded arguments. // through value-initialization using the provided forwarded arguments.
...@@ -548,7 +543,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -548,7 +543,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
variant_internal::VariantAlternativeSfinaeT<I, variant>, variant_internal::VariantAlternativeSfinaeT<I, variant>,
Args...>::value>::type* = nullptr> Args...>::value>::type* = nullptr>
constexpr explicit variant(in_place_index_t<I>, Args&&... args) constexpr explicit variant(in_place_index_t<I>, Args&&... args)
: Base(variant_internal::EmplaceTag<I>(), absl::forward<Args>(args)...) {} : Base(variant_internal::EmplaceTag<I>(), std::forward<Args>(args)...) {}
// Constructs a variant of an alternative type from a provided index, // Constructs a variant of an alternative type from a provided index,
// through value-initialization of an initializer list and the provided // through value-initialization of an initializer list and the provided
...@@ -560,7 +555,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -560,7 +555,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
constexpr explicit variant(in_place_index_t<I>, std::initializer_list<U> il, constexpr explicit variant(in_place_index_t<I>, std::initializer_list<U> il,
Args&&... args) Args&&... args)
: Base(variant_internal::EmplaceTag<I>(), il, : Base(variant_internal::EmplaceTag<I>(), il,
absl::forward<Args>(args)...) {} std::forward<Args>(args)...) {}
// Destructors // Destructors
...@@ -595,7 +590,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -595,7 +590,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
std::is_nothrow_constructible<Tj, T>::value) { std::is_nothrow_constructible<Tj, T>::value) {
variant_internal::VisitIndices<sizeof...(Tn) + 1>::Run( variant_internal::VisitIndices<sizeof...(Tn) + 1>::Run(
variant_internal::VariantCoreAccess::MakeConversionAssignVisitor( variant_internal::VariantCoreAccess::MakeConversionAssignVisitor(
this, absl::forward<T>(t)), this, std::forward<T>(t)),
index()); index());
return *this; return *this;
...@@ -623,7 +618,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -623,7 +618,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
T& emplace(Args&&... args) { T& emplace(Args&&... args) {
return variant_internal::VariantCoreAccess::Replace< return variant_internal::VariantCoreAccess::Replace<
variant_internal::UnambiguousIndexOf<variant, T>::value>( variant_internal::UnambiguousIndexOf<variant, T>::value>(
this, absl::forward<Args>(args)...); this, std::forward<Args>(args)...);
} }
// Constructs a value of the given alternative type T within the variant using // Constructs a value of the given alternative type T within the variant using
...@@ -644,7 +639,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -644,7 +639,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
T& emplace(std::initializer_list<U> il, Args&&... args) { T& emplace(std::initializer_list<U> il, Args&&... args) {
return variant_internal::VariantCoreAccess::Replace< return variant_internal::VariantCoreAccess::Replace<
variant_internal::UnambiguousIndexOf<variant, T>::value>( variant_internal::UnambiguousIndexOf<variant, T>::value>(
this, il, absl::forward<Args>(args)...); this, il, std::forward<Args>(args)...);
} }
// Destroys the current value of the variant (provided that // Destroys the current value of the variant (provided that
...@@ -663,7 +658,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -663,7 +658,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
Args...>::value>::type* = nullptr> Args...>::value>::type* = nullptr>
absl::variant_alternative_t<I, variant>& emplace(Args&&... args) { absl::variant_alternative_t<I, variant>& emplace(Args&&... args) {
return variant_internal::VariantCoreAccess::Replace<I>( return variant_internal::VariantCoreAccess::Replace<I>(
this, absl::forward<Args>(args)...); this, std::forward<Args>(args)...);
} }
// Destroys the current value of the variant (provided that // Destroys the current value of the variant (provided that
...@@ -681,7 +676,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> { ...@@ -681,7 +676,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
absl::variant_alternative_t<I, variant>& emplace(std::initializer_list<U> il, absl::variant_alternative_t<I, variant>& emplace(std::initializer_list<U> il,
Args&&... args) { Args&&... args) {
return variant_internal::VariantCoreAccess::Replace<I>( return variant_internal::VariantCoreAccess::Replace<I>(
this, il, absl::forward<Args>(args)...); this, il, std::forward<Args>(args)...);
} }
// variant::valueless_by_exception() // variant::valueless_by_exception()
......
...@@ -389,7 +389,7 @@ TEST(VariantTest, TestMoveConstruct) { ...@@ -389,7 +389,7 @@ TEST(VariantTest, TestMoveConstruct) {
using V = variant<MoveOnly<class A>, MoveOnly<class B>, MoveOnly<class C>>; using V = variant<MoveOnly<class A>, MoveOnly<class B>, MoveOnly<class C>>;
V v(in_place_index<1>, 10); V v(in_place_index<1>, 10);
V v2 = absl::move(v); V v2 = std::move(v);
EXPECT_EQ(10, absl::get<1>(v2).value); EXPECT_EQ(10, absl::get<1>(v2).value);
} }
...@@ -1209,60 +1209,60 @@ TEST(VariantTest, GetIndex) { ...@@ -1209,60 +1209,60 @@ TEST(VariantTest, GetIndex) {
Var v(absl::in_place_index<0>, 0); Var v(absl::in_place_index<0>, 0);
using LValueGetType = decltype(absl::get<0>(v)); using LValueGetType = decltype(absl::get<0>(v));
using RValueGetType = decltype(absl::get<0>(absl::move(v))); using RValueGetType = decltype(absl::get<0>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, int&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, int&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, int&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, int&&>::value));
EXPECT_EQ(absl::get<0>(v), 0); EXPECT_EQ(absl::get<0>(v), 0);
EXPECT_EQ(absl::get<0>(absl::move(v)), 0); EXPECT_EQ(absl::get<0>(std::move(v)), 0);
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<0>(const_v)); using ConstLValueGetType = decltype(absl::get<0>(const_v));
using ConstRValueGetType = decltype(absl::get<0>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<0>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const int&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const int&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const int&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const int&&>::value));
EXPECT_EQ(absl::get<0>(const_v), 0); EXPECT_EQ(absl::get<0>(const_v), 0);
EXPECT_EQ(absl::get<0>(absl::move(const_v)), 0); EXPECT_EQ(absl::get<0>(std::move(const_v)), 0);
} }
{ {
Var v = std::string("Hello"); Var v = std::string("Hello");
using LValueGetType = decltype(absl::get<1>(v)); using LValueGetType = decltype(absl::get<1>(v));
using RValueGetType = decltype(absl::get<1>(absl::move(v))); using RValueGetType = decltype(absl::get<1>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, std::string&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, std::string&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, std::string&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, std::string&&>::value));
EXPECT_EQ(absl::get<1>(v), "Hello"); EXPECT_EQ(absl::get<1>(v), "Hello");
EXPECT_EQ(absl::get<1>(absl::move(v)), "Hello"); EXPECT_EQ(absl::get<1>(std::move(v)), "Hello");
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<1>(const_v)); using ConstLValueGetType = decltype(absl::get<1>(const_v));
using ConstRValueGetType = decltype(absl::get<1>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<1>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const std::string&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const std::string&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const std::string&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const std::string&&>::value));
EXPECT_EQ(absl::get<1>(const_v), "Hello"); EXPECT_EQ(absl::get<1>(const_v), "Hello");
EXPECT_EQ(absl::get<1>(absl::move(const_v)), "Hello"); EXPECT_EQ(absl::get<1>(std::move(const_v)), "Hello");
} }
{ {
Var v = 2.0; Var v = 2.0;
using LValueGetType = decltype(absl::get<2>(v)); using LValueGetType = decltype(absl::get<2>(v));
using RValueGetType = decltype(absl::get<2>(absl::move(v))); using RValueGetType = decltype(absl::get<2>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, double&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, double&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, double&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, double&&>::value));
EXPECT_EQ(absl::get<2>(v), 2.); EXPECT_EQ(absl::get<2>(v), 2.);
EXPECT_EQ(absl::get<2>(absl::move(v)), 2.); EXPECT_EQ(absl::get<2>(std::move(v)), 2.);
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<2>(const_v)); using ConstLValueGetType = decltype(absl::get<2>(const_v));
using ConstRValueGetType = decltype(absl::get<2>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<2>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const double&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const double&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const double&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const double&&>::value));
EXPECT_EQ(absl::get<2>(const_v), 2.); EXPECT_EQ(absl::get<2>(const_v), 2.);
EXPECT_EQ(absl::get<2>(absl::move(const_v)), 2.); EXPECT_EQ(absl::get<2>(std::move(const_v)), 2.);
} }
{ {
...@@ -1270,20 +1270,20 @@ TEST(VariantTest, GetIndex) { ...@@ -1270,20 +1270,20 @@ TEST(VariantTest, GetIndex) {
v.emplace<3>(1); v.emplace<3>(1);
using LValueGetType = decltype(absl::get<3>(v)); using LValueGetType = decltype(absl::get<3>(v));
using RValueGetType = decltype(absl::get<3>(absl::move(v))); using RValueGetType = decltype(absl::get<3>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, int&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, int&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, int&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, int&&>::value));
EXPECT_EQ(absl::get<3>(v), 1); EXPECT_EQ(absl::get<3>(v), 1);
EXPECT_EQ(absl::get<3>(absl::move(v)), 1); EXPECT_EQ(absl::get<3>(std::move(v)), 1);
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<3>(const_v)); using ConstLValueGetType = decltype(absl::get<3>(const_v));
using ConstRValueGetType = decltype(absl::get<3>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<3>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const int&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const int&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const int&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const int&&>::value));
EXPECT_EQ(absl::get<3>(const_v), 1); EXPECT_EQ(absl::get<3>(const_v), 1);
EXPECT_EQ(absl::get<3>(absl::move(const_v)), 1); // NOLINT EXPECT_EQ(absl::get<3>(std::move(const_v)), 1); // NOLINT
} }
} }
...@@ -1322,60 +1322,60 @@ TEST(VariantTest, GetType) { ...@@ -1322,60 +1322,60 @@ TEST(VariantTest, GetType) {
Var v = 1; Var v = 1;
using LValueGetType = decltype(absl::get<int>(v)); using LValueGetType = decltype(absl::get<int>(v));
using RValueGetType = decltype(absl::get<int>(absl::move(v))); using RValueGetType = decltype(absl::get<int>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, int&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, int&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, int&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, int&&>::value));
EXPECT_EQ(absl::get<int>(v), 1); EXPECT_EQ(absl::get<int>(v), 1);
EXPECT_EQ(absl::get<int>(absl::move(v)), 1); EXPECT_EQ(absl::get<int>(std::move(v)), 1);
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<int>(const_v)); using ConstLValueGetType = decltype(absl::get<int>(const_v));
using ConstRValueGetType = decltype(absl::get<int>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<int>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const int&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const int&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const int&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const int&&>::value));
EXPECT_EQ(absl::get<int>(const_v), 1); EXPECT_EQ(absl::get<int>(const_v), 1);
EXPECT_EQ(absl::get<int>(absl::move(const_v)), 1); EXPECT_EQ(absl::get<int>(std::move(const_v)), 1);
} }
{ {
Var v = std::string("Hello"); Var v = std::string("Hello");
using LValueGetType = decltype(absl::get<1>(v)); using LValueGetType = decltype(absl::get<1>(v));
using RValueGetType = decltype(absl::get<1>(absl::move(v))); using RValueGetType = decltype(absl::get<1>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, std::string&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, std::string&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, std::string&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, std::string&&>::value));
EXPECT_EQ(absl::get<std::string>(v), "Hello"); EXPECT_EQ(absl::get<std::string>(v), "Hello");
EXPECT_EQ(absl::get<std::string>(absl::move(v)), "Hello"); EXPECT_EQ(absl::get<std::string>(std::move(v)), "Hello");
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<1>(const_v)); using ConstLValueGetType = decltype(absl::get<1>(const_v));
using ConstRValueGetType = decltype(absl::get<1>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<1>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const std::string&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const std::string&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const std::string&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const std::string&&>::value));
EXPECT_EQ(absl::get<std::string>(const_v), "Hello"); EXPECT_EQ(absl::get<std::string>(const_v), "Hello");
EXPECT_EQ(absl::get<std::string>(absl::move(const_v)), "Hello"); EXPECT_EQ(absl::get<std::string>(std::move(const_v)), "Hello");
} }
{ {
Var v = 2.0; Var v = 2.0;
using LValueGetType = decltype(absl::get<2>(v)); using LValueGetType = decltype(absl::get<2>(v));
using RValueGetType = decltype(absl::get<2>(absl::move(v))); using RValueGetType = decltype(absl::get<2>(std::move(v)));
EXPECT_TRUE((std::is_same<LValueGetType, double&>::value)); EXPECT_TRUE((std::is_same<LValueGetType, double&>::value));
EXPECT_TRUE((std::is_same<RValueGetType, double&&>::value)); EXPECT_TRUE((std::is_same<RValueGetType, double&&>::value));
EXPECT_EQ(absl::get<double>(v), 2.); EXPECT_EQ(absl::get<double>(v), 2.);
EXPECT_EQ(absl::get<double>(absl::move(v)), 2.); EXPECT_EQ(absl::get<double>(std::move(v)), 2.);
const Var& const_v = v; const Var& const_v = v;
using ConstLValueGetType = decltype(absl::get<2>(const_v)); using ConstLValueGetType = decltype(absl::get<2>(const_v));
using ConstRValueGetType = decltype(absl::get<2>(absl::move(const_v))); using ConstRValueGetType = decltype(absl::get<2>(std::move(const_v)));
EXPECT_TRUE((std::is_same<ConstLValueGetType, const double&>::value)); EXPECT_TRUE((std::is_same<ConstLValueGetType, const double&>::value));
EXPECT_TRUE((std::is_same<ConstRValueGetType, const double&&>::value)); EXPECT_TRUE((std::is_same<ConstRValueGetType, const double&&>::value));
EXPECT_EQ(absl::get<double>(const_v), 2.); EXPECT_EQ(absl::get<double>(const_v), 2.);
EXPECT_EQ(absl::get<double>(absl::move(const_v)), 2.); EXPECT_EQ(absl::get<double>(std::move(const_v)), 2.);
} }
} }
...@@ -1825,13 +1825,13 @@ TEST(VariantTest, VisitRValue) { ...@@ -1825,13 +1825,13 @@ TEST(VariantTest, VisitRValue) {
int operator()(std::string&&, std::string&&) const { return 3; } // NOLINT int operator()(std::string&&, std::string&&) const { return 3; } // NOLINT
}; };
EXPECT_FALSE(absl::visit(Visitor{}, v)); EXPECT_FALSE(absl::visit(Visitor{}, v));
EXPECT_TRUE(absl::visit(Visitor{}, absl::move(v))); EXPECT_TRUE(absl::visit(Visitor{}, std::move(v)));
// Also test the variadic overload. // Also test the variadic overload.
EXPECT_EQ(0, absl::visit(Visitor{}, v, v)); EXPECT_EQ(0, absl::visit(Visitor{}, v, v));
EXPECT_EQ(1, absl::visit(Visitor{}, v, absl::move(v))); EXPECT_EQ(1, absl::visit(Visitor{}, v, std::move(v)));
EXPECT_EQ(2, absl::visit(Visitor{}, absl::move(v), v)); EXPECT_EQ(2, absl::visit(Visitor{}, std::move(v), v));
EXPECT_EQ(3, absl::visit(Visitor{}, absl::move(v), absl::move(v))); EXPECT_EQ(3, absl::visit(Visitor{}, std::move(v), std::move(v)));
} }
TEST(VariantTest, VisitRValueVisitor) { TEST(VariantTest, VisitRValueVisitor) {
...@@ -1862,12 +1862,12 @@ TEST(VariantTest, VisitResultTypeDifferent) { ...@@ -1862,12 +1862,12 @@ TEST(VariantTest, VisitResultTypeDifferent) {
(std::is_same<LValue_LValue, decltype(absl::visit(visitor, v))>::value)); (std::is_same<LValue_LValue, decltype(absl::visit(visitor, v))>::value));
EXPECT_TRUE( EXPECT_TRUE(
(std::is_same<RValue_LValue, (std::is_same<RValue_LValue,
decltype(absl::visit(visitor, absl::move(v)))>::value)); decltype(absl::visit(visitor, std::move(v)))>::value));
EXPECT_TRUE(( EXPECT_TRUE((
std::is_same<LValue_RValue, decltype(absl::visit(Visitor{}, v))>::value)); std::is_same<LValue_RValue, decltype(absl::visit(Visitor{}, v))>::value));
EXPECT_TRUE( EXPECT_TRUE(
(std::is_same<RValue_RValue, (std::is_same<RValue_RValue,
decltype(absl::visit(Visitor{}, absl::move(v)))>::value)); decltype(absl::visit(Visitor{}, std::move(v)))>::value));
} }
TEST(VariantTest, VisitVariadic) { TEST(VariantTest, VisitVariadic) {
...@@ -2225,7 +2225,7 @@ TEST(VariantTest, TestMoveSemantics) { ...@@ -2225,7 +2225,7 @@ TEST(VariantTest, TestMoveSemantics) {
EXPECT_TRUE(absl::holds_alternative<std::unique_ptr<int>>(v)); EXPECT_TRUE(absl::holds_alternative<std::unique_ptr<int>>(v));
// Construct a variant by moving from another variant. // Construct a variant by moving from another variant.
Variant v2(absl::move(v)); Variant v2(std::move(v));
ASSERT_TRUE(absl::holds_alternative<std::unique_ptr<int>>(v2)); ASSERT_TRUE(absl::holds_alternative<std::unique_ptr<int>>(v2));
ASSERT_NE(nullptr, absl::get<std::unique_ptr<int>>(v2)); ASSERT_NE(nullptr, absl::get<std::unique_ptr<int>>(v2));
EXPECT_EQ(10, *absl::get<std::unique_ptr<int>>(v2)); EXPECT_EQ(10, *absl::get<std::unique_ptr<int>>(v2));
...@@ -2242,7 +2242,7 @@ TEST(VariantTest, TestMoveSemantics) { ...@@ -2242,7 +2242,7 @@ TEST(VariantTest, TestMoveSemantics) {
EXPECT_EQ("foo", *absl::get<std::unique_ptr<std::string>>(v)); EXPECT_EQ("foo", *absl::get<std::unique_ptr<std::string>>(v));
// Move-assign a variant. // Move-assign a variant.
v2 = absl::move(v); v2 = std::move(v);
ASSERT_TRUE(absl::holds_alternative<std::unique_ptr<std::string>>(v2)); ASSERT_TRUE(absl::holds_alternative<std::unique_ptr<std::string>>(v2));
EXPECT_EQ("foo", *absl::get<std::unique_ptr<std::string>>(v2)); EXPECT_EQ("foo", *absl::get<std::unique_ptr<std::string>>(v2));
EXPECT_TRUE(absl::holds_alternative<std::unique_ptr<std::string>>(v)); EXPECT_TRUE(absl::holds_alternative<std::unique_ptr<std::string>>(v));
...@@ -2568,7 +2568,7 @@ TEST(VariantTest, TestVectorOfMoveonlyVariant) { ...@@ -2568,7 +2568,7 @@ TEST(VariantTest, TestVectorOfMoveonlyVariant) {
vec.push_back(absl::make_unique<int>(42)); vec.push_back(absl::make_unique<int>(42));
vec.emplace_back("Hello"); vec.emplace_back("Hello");
vec.reserve(3); vec.reserve(3);
auto another_vec = absl::move(vec); auto another_vec = std::move(vec);
// As a sanity check, verify vector contents. // As a sanity check, verify vector contents.
ASSERT_EQ(2u, another_vec.size()); ASSERT_EQ(2u, another_vec.size());
EXPECT_EQ(42, *absl::get<std::unique_ptr<int>>(another_vec[0])); EXPECT_EQ(42, *absl::get<std::unique_ptr<int>>(another_vec[0]));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment