summaryrefslogtreecommitdiff
path: root/absl/types
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <bbaren@google.com>2024-09-03 11:49:29 -0400
committerGravatar Benjamin Barenblat <bbaren@google.com>2024-09-03 11:49:29 -0400
commitc1afa8b8238c25591ca80d068477aa7d4ce05fc8 (patch)
tree284a9f8b319de5783ff83ad004a9e390cb60fd0d /absl/types
parent23778b53f420f54eebc195dd8430e79bda165e5b (diff)
parent4447c7562e3bc702ade25105912dce503f0c4010 (diff)
Merge new upstream LTS 20240722.0
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/BUILD.bazel1
-rw-r--r--absl/types/CMakeLists.txt1
-rw-r--r--absl/types/internal/optional.h4
-rw-r--r--absl/types/internal/variant.h122
-rw-r--r--absl/types/optional.h33
-rw-r--r--absl/types/optional_test.cc45
-rw-r--r--absl/types/span.h5
-rw-r--r--absl/types/span_test.cc5
-rw-r--r--absl/types/variant.h43
-rw-r--r--absl/types/variant_test.cc76
10 files changed, 140 insertions, 195 deletions
diff --git a/absl/types/BUILD.bazel b/absl/types/BUILD.bazel
index ce8f605b..a86e2c13 100644
--- a/absl/types/BUILD.bazel
+++ b/absl/types/BUILD.bazel
@@ -138,6 +138,7 @@ cc_test(
"//absl/container:fixed_array",
"//absl/container:inlined_vector",
"//absl/hash:hash_testing",
+ "//absl/meta:type_traits",
"//absl/strings",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
diff --git a/absl/types/CMakeLists.txt b/absl/types/CMakeLists.txt
index 92b4ae49..fed532fc 100644
--- a/absl/types/CMakeLists.txt
+++ b/absl/types/CMakeLists.txt
@@ -138,6 +138,7 @@ absl_cc_test(
absl::inlined_vector
absl::hash_testing
absl::strings
+ absl::type_traits
GTest::gmock_main
)
diff --git a/absl/types/internal/optional.h b/absl/types/internal/optional.h
index a96d260a..5731a5bc 100644
--- a/absl/types/internal/optional.h
+++ b/absl/types/internal/optional.h
@@ -81,7 +81,7 @@ class optional_data_dtor_base {
template <typename... 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(); }
};
@@ -110,7 +110,7 @@ class optional_data_dtor_base<T, true> {
template <typename... 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>
diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h
index 263d7b09..4cb15f29 100644
--- a/absl/types/internal/variant.h
+++ b/absl/types/internal/variant.h
@@ -26,6 +26,7 @@
#include <stdexcept>
#include <tuple>
#include <type_traits>
+#include <utility>
#include "absl/base/config.h"
#include "absl/base/internal/identity.h"
@@ -214,7 +215,7 @@ constexpr ReturnType call_with_indices(FunctionObject&& function) {
std::is_same<ReturnType, decltype(std::declval<FunctionObject>()(
SizeT<Indices>()...))>::value,
"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>
@@ -272,27 +273,14 @@ struct UnreachableSwitchCase {
template <class Op>
[[noreturn]] static VisitIndicesResultT<Op, std::size_t> Run(
Op&& /*ignored*/) {
-#if ABSL_HAVE_BUILTIN(__builtin_unreachable) || \
- (defined(__GNUC__) && !defined(__clang__))
- __builtin_unreachable();
-#elif defined(_MSC_VER)
- __assume(false);
-#else
- // Try to use assert of false being identified as an unreachable intrinsic.
- // NOTE: We use assert directly to increase chances of exploiting an assume
- // intrinsic.
- assert(false); // NOLINT
-
- // Hack to silence potential no return warning -- cause an infinite loop.
- return Run(absl::forward<Op>(op));
-#endif // Checks for __builtin_unreachable
+ ABSL_UNREACHABLE();
}
};
template <class Op, std::size_t I>
struct ReachableSwitchCase {
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 +345,74 @@ struct VisitIndicesSwitch {
static VisitIndicesResultT<Op, std::size_t> Run(Op&& op, std::size_t i) {
switch (i) {
case 0:
- return PickCase<Op, 0, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 0, EndIndex>::Run(std::forward<Op>(op));
case 1:
- return PickCase<Op, 1, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 1, EndIndex>::Run(std::forward<Op>(op));
case 2:
- return PickCase<Op, 2, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 2, EndIndex>::Run(std::forward<Op>(op));
case 3:
- return PickCase<Op, 3, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 3, EndIndex>::Run(std::forward<Op>(op));
case 4:
- return PickCase<Op, 4, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 4, EndIndex>::Run(std::forward<Op>(op));
case 5:
- return PickCase<Op, 5, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 5, EndIndex>::Run(std::forward<Op>(op));
case 6:
- return PickCase<Op, 6, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 6, EndIndex>::Run(std::forward<Op>(op));
case 7:
- return PickCase<Op, 7, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 7, EndIndex>::Run(std::forward<Op>(op));
case 8:
- return PickCase<Op, 8, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 8, EndIndex>::Run(std::forward<Op>(op));
case 9:
- return PickCase<Op, 9, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 9, EndIndex>::Run(std::forward<Op>(op));
case 10:
- return PickCase<Op, 10, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 10, EndIndex>::Run(std::forward<Op>(op));
case 11:
- return PickCase<Op, 11, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 11, EndIndex>::Run(std::forward<Op>(op));
case 12:
- return PickCase<Op, 12, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 12, EndIndex>::Run(std::forward<Op>(op));
case 13:
- return PickCase<Op, 13, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 13, EndIndex>::Run(std::forward<Op>(op));
case 14:
- return PickCase<Op, 14, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 14, EndIndex>::Run(std::forward<Op>(op));
case 15:
- return PickCase<Op, 15, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 15, EndIndex>::Run(std::forward<Op>(op));
case 16:
- return PickCase<Op, 16, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 16, EndIndex>::Run(std::forward<Op>(op));
case 17:
- return PickCase<Op, 17, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 17, EndIndex>::Run(std::forward<Op>(op));
case 18:
- return PickCase<Op, 18, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 18, EndIndex>::Run(std::forward<Op>(op));
case 19:
- return PickCase<Op, 19, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 19, EndIndex>::Run(std::forward<Op>(op));
case 20:
- return PickCase<Op, 20, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 20, EndIndex>::Run(std::forward<Op>(op));
case 21:
- return PickCase<Op, 21, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 21, EndIndex>::Run(std::forward<Op>(op));
case 22:
- return PickCase<Op, 22, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 22, EndIndex>::Run(std::forward<Op>(op));
case 23:
- return PickCase<Op, 23, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 23, EndIndex>::Run(std::forward<Op>(op));
case 24:
- return PickCase<Op, 24, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 24, EndIndex>::Run(std::forward<Op>(op));
case 25:
- return PickCase<Op, 25, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 25, EndIndex>::Run(std::forward<Op>(op));
case 26:
- return PickCase<Op, 26, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 26, EndIndex>::Run(std::forward<Op>(op));
case 27:
- return PickCase<Op, 27, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 27, EndIndex>::Run(std::forward<Op>(op));
case 28:
- return PickCase<Op, 28, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 28, EndIndex>::Run(std::forward<Op>(op));
case 29:
- return PickCase<Op, 29, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 29, EndIndex>::Run(std::forward<Op>(op));
case 30:
- return PickCase<Op, 30, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 30, EndIndex>::Run(std::forward<Op>(op));
case 31:
- return PickCase<Op, 31, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 31, EndIndex>::Run(std::forward<Op>(op));
case 32:
- return PickCase<Op, 32, EndIndex>::Run(absl::forward<Op>(op));
+ return PickCase<Op, 32, EndIndex>::Run(std::forward<Op>(op));
default:
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 +425,7 @@ struct VisitIndicesFallback {
MakeVisitationMatrix<VisitIndicesResultT<Op, SizeT...>, Op,
index_sequence<(EndIndices + 1)...>,
index_sequence<>>::Run(),
- (indices + 1)...)(absl::forward<Op>(op));
+ (indices + 1)...)(std::forward<Op>(op));
}
};
@@ -489,7 +477,7 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
VisitIndicesResultT<Op, decltype(EndIndices)...> operator()(
SizeT<I> /*index*/) && {
return base_internal::invoke(
- absl::forward<Op>(op),
+ std::forward<Op>(op),
SizeT<UnflattenIndex<I, N, (EndIndices + 1)...>::value -
std::size_t{1}>()...);
}
@@ -501,7 +489,7 @@ struct VisitIndicesVariadicImpl<absl::index_sequence<N...>, EndIndices...> {
static VisitIndicesResultT<Op, decltype(EndIndices)...> Run(Op&& op,
SizeType... i) {
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(
(i + std::size_t{1})...));
}
@@ -612,7 +600,7 @@ struct VariantCoreAccess {
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.
@@ -684,7 +672,7 @@ struct VariantCoreAccess {
void operator()(SizeT<NewIndex::value> /*old_i*/
) const {
- Access<NewIndex::value>(*left) = absl::forward<QualifiedNew>(other);
+ Access<NewIndex::value>(*left) = std::forward<QualifiedNew>(other);
}
template <std::size_t OldIndex>
@@ -695,13 +683,13 @@ struct VariantCoreAccess {
if (std::is_nothrow_constructible<New, QualifiedNew>::value ||
!std::is_nothrow_move_constructible<New>::value) {
left->template emplace<NewIndex::value>(
- absl::forward<QualifiedNew>(other));
+ std::forward<QualifiedNew>(other));
} else {
// the standard says "equivalent to
// operator=(variant(std::forward<T>(t)))", but we use `emplace` here
// because the variant's move assignment operator could be deleted.
left->template emplace<NewIndex::value>(
- New(absl::forward<QualifiedNew>(other)));
+ New(std::forward<QualifiedNew>(other)));
}
}
@@ -712,7 +700,7 @@ struct VariantCoreAccess {
template <class Left, class QualifiedNew>
static ConversionAssignVisitor<Left, QualifiedNew>
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
@@ -723,7 +711,7 @@ struct VariantCoreAccess {
Destroy(*self);
using New = typename absl::variant_alternative<NewIndex, Self>::type;
New* const result = ::new (static_cast<void*>(&self->state_))
- New(absl::forward<Args>(args)...);
+ New(std::forward<Args>(args)...);
self->index_ = NewIndex;
return *result;
}
@@ -919,9 +907,9 @@ struct PerformVisitation {
Is, QualifiedVariants>...)>>::value,
"All visitation overloads must have the same return type.");
return absl::base_internal::invoke(
- absl::forward<Op>(op),
+ std::forward<Op>(op),
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>
@@ -969,11 +957,11 @@ union Union<Head, Tail...> {
template <class... P>
explicit constexpr Union(EmplaceTag<0>, P&&... args)
- : head(absl::forward<P>(args)...) {}
+ : head(std::forward<P>(args)...) {}
template <std::size_t I, class... P>
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;
TailUnion tail;
@@ -1001,11 +989,11 @@ union DestructibleUnionImpl<Head, Tail...> {
template <class... P>
explicit constexpr DestructibleUnionImpl(EmplaceTag<0>, P&&... args)
- : head(absl::forward<P>(args)...) {}
+ : head(std::forward<P>(args)...) {}
template <std::size_t I, class... P>
explicit constexpr DestructibleUnionImpl(EmplaceTag<I>, P&&... args)
- : tail(EmplaceTag<I - 1>{}, absl::forward<P>(args)...) {}
+ : tail(EmplaceTag<I - 1>{}, std::forward<P>(args)...) {}
~DestructibleUnionImpl() {}
@@ -1036,7 +1024,7 @@ class VariantStateBase {
template <std::size_t I, class... P>
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)
: state_(NoopConstructorTag()), index_(variant_npos) {}
@@ -1321,7 +1309,7 @@ class VariantMoveBaseNontrivial : protected VariantStateBaseDestructor<T...> {
using Alternative =
typename absl::variant_alternative<I, variant<T...>>::type;
::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 {}
diff --git a/absl/types/optional.h b/absl/types/optional.h
index 395fe62f..cf7249cb 100644
--- a/absl/types/optional.h
+++ b/absl/types/optional.h
@@ -151,7 +151,7 @@ class optional : private optional_internal::optional_data<T>,
std::is_same<InPlaceT, in_place_t>,
std::is_constructible<T, Args&&...> >::value>* = nullptr>
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
// the arguments of an initializer_list and `std::forward<Args>(args)...`.
@@ -162,8 +162,7 @@ class optional : private optional_internal::optional_data<T>,
T, std::initializer_list<U>&, Args&&...>::value>::type>
constexpr explicit optional(in_place_t, std::initializer_list<U> il,
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)
template <
@@ -176,21 +175,21 @@ class optional : private optional_internal::optional_data<T>,
std::is_convertible<U&&, T>,
std::is_constructible<T, U&&> >::value,
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)
template <
typename U = T,
typename std::enable_if<
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<
- optional<T>, typename std::decay<U>::type>>,
- absl::negation<std::is_convertible<U&&, T>>,
- std::is_constructible<T, U&&>>::value,
+ optional<T>, typename std::decay<U>::type> >,
+ absl::negation<std::is_convertible<U&&, T> >,
+ std::is_constructible<T, U&&> >::value,
bool>::type = false>
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)
template <typename U,
@@ -437,7 +436,7 @@ class optional : private optional_internal::optional_data<T>,
return reference();
}
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 {
ABSL_HARDENING_ASSERT(this->engaged_);
@@ -492,7 +491,7 @@ class optional : private optional_internal::optional_data<T>,
}
constexpr const T&& value()
const&& ABSL_ATTRIBUTE_LIFETIME_BOUND { // NOLINT(build/c++11)
- return absl::move(
+ return std::move(
static_cast<bool>(*this)
? reference()
: (optional_internal::throw_bad_optional_access(), reference()));
@@ -511,9 +510,8 @@ class optional : private optional_internal::optional_data<T>,
"optional<T>::value_or: T must be copy constructible");
static_assert(std::is_convertible<U&&, value_type>::value,
"optional<T>::value_or: U must be convertible to T");
- return static_cast<bool>(*this)
- ? **this
- : static_cast<T>(absl::forward<U>(v));
+ return static_cast<bool>(*this) ? **this
+ : static_cast<T>(std::forward<U>(v));
}
template <typename U>
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))) {
// static_assert(opt.value() == 1, "");
template <typename T>
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>
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>
constexpr optional<T> make_optional(std::initializer_list<U> il,
Args&&... args) {
- return optional<T>(in_place_t(), il,
- absl::forward<Args>(args)...);
+ return optional<T>(in_place_t(), il, std::forward<Args>(args)...);
}
// Relational operators [optional.relops]
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index 5da297b0..115e20ce 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -982,37 +982,6 @@ TEST(optionalTest, PointerStuff) {
static_assert((*opt1).x == ConstexprType::kCtorInt, "");
}
-// gcc has a bug pre 4.9.1 where it doesn't do correct overload resolution
-// when overloads are const-qualified and *this is an raluve.
-// Skip that test to make the build green again when using the old compiler.
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59296 is fixed in 4.9.1.
-#if defined(__GNUC__) && !defined(__clang__)
-#define GCC_VERSION \
- (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-#if GCC_VERSION < 40901
-#define ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
-#endif
-#endif
-
-// MSVC has a bug with "cv-qualifiers in class construction", fixed in 2017. See
-// https://docs.microsoft.com/en-us/cpp/cpp-conformance-improvements-2017#bug-fixes
-// The compiler some incorrectly ignores the cv-qualifier when generating a
-// class object via a constructor call. For example:
-//
-// class optional {
-// constexpr T&& value() &&;
-// constexpr const T&& value() const &&;
-// }
-//
-// using COI = const absl::optional<int>;
-// static_assert(2 == COI(2).value(), ""); // const &&
-//
-// This should invoke the "const &&" overload but since it ignores the const
-// qualifier it finds the "&&" overload the best candidate.
-#if defined(_MSC_VER) && _MSC_VER < 1910
-#define ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG
-#endif
-
TEST(optionalTest, Value) {
using O = absl::optional<std::string>;
using CO = const absl::optional<std::string>;
@@ -1025,17 +994,12 @@ TEST(optionalTest, Value) {
EXPECT_EQ("lvalue_c", lvalue_c.value());
EXPECT_EQ("xvalue", O(absl::in_place, "xvalue").value());
EXPECT_EQ("xvalue_c", OC(absl::in_place, "xvalue_c").value());
-#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
EXPECT_EQ("cxvalue", CO(absl::in_place, "cxvalue").value());
-#endif
EXPECT_EQ("&", TypeQuals(lvalue.value()));
EXPECT_EQ("c&", TypeQuals(clvalue.value()));
EXPECT_EQ("c&", TypeQuals(lvalue_c.value()));
EXPECT_EQ("&&", TypeQuals(O(absl::in_place, "xvalue").value()));
-#if !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG) && \
- !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
EXPECT_EQ("c&&", TypeQuals(CO(absl::in_place, "cxvalue").value()));
-#endif
EXPECT_EQ("c&&", TypeQuals(OC(absl::in_place, "xvalue_c").value()));
#if !defined(ABSL_VOLATILE_RETURN_TYPES_DEPRECATED)
@@ -1059,7 +1023,7 @@ TEST(optionalTest, Value) {
// test constexpr value()
constexpr absl::optional<int> o1(1);
static_assert(1 == o1.value(), ""); // const &
-#if !defined(_MSC_VER) && !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
+#ifndef _MSC_VER
using COI = const absl::optional<int>;
static_assert(2 == COI(2).value(), ""); // const &&
#endif
@@ -1077,16 +1041,11 @@ TEST(optionalTest, DerefOperator) {
EXPECT_EQ("lvalue_c", *lvalue_c);
EXPECT_EQ("xvalue", *O(absl::in_place, "xvalue"));
EXPECT_EQ("xvalue_c", *OC(absl::in_place, "xvalue_c"));
-#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG
EXPECT_EQ("cxvalue", *CO(absl::in_place, "cxvalue"));
-#endif
EXPECT_EQ("&", TypeQuals(*lvalue));
EXPECT_EQ("c&", TypeQuals(*clvalue));
EXPECT_EQ("&&", TypeQuals(*O(absl::in_place, "xvalue")));
-#if !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG) && \
- !defined(ABSL_SKIP_OVERLOAD_TEST_DUE_TO_GCC_BUG)
EXPECT_EQ("c&&", TypeQuals(*CO(absl::in_place, "cxvalue")));
-#endif
EXPECT_EQ("c&&", TypeQuals(*OC(absl::in_place, "xvalue_c")));
#if !defined(ABSL_VOLATILE_RETURN_TYPES_DEPRECATED)
@@ -1117,11 +1076,9 @@ TEST(optionalTest, ValueOr) {
constexpr absl::optional<double> copt_empty, copt_set = {1.2};
static_assert(42.0 == copt_empty.value_or(42), "");
static_assert(1.2 == copt_set.value_or(42), "");
-#ifndef ABSL_SKIP_OVERLOAD_TEST_DUE_TO_MSVC_BUG
using COD = const absl::optional<double>;
static_assert(42.0 == COD().value_or(42), "");
static_assert(1.2 == COD(1.2).value_or(42), "");
-#endif
}
// make_optional cannot be constexpr until C++17
diff --git a/absl/types/span.h b/absl/types/span.h
index 88cd7595..a0f80272 100644
--- a/absl/types/span.h
+++ b/absl/types/span.h
@@ -43,7 +43,7 @@
// * A read-only `absl::Span<const T>` can be implicitly constructed from an
// initializer list.
// * `absl::Span` has no `bytes()`, `size_bytes()`, `as_bytes()`, or
-// `as_mutable_bytes()` methods
+// `as_writable_bytes()` methods
// * `absl::Span` has no static extent template parameter, nor constructors
// which exist only because of the static extent parameter.
// * `absl::Span` has an explicit mutable-reference constructor
@@ -151,7 +151,7 @@ ABSL_NAMESPACE_BEGIN
// int* my_array = new int[10];
// MyRoutine(absl::Span<const int>(my_array, 10));
template <typename T>
-class Span {
+class ABSL_INTERNAL_ATTRIBUTE_VIEW Span {
private:
// Used to determine whether a Span can be constructed from a container of
// type C.
@@ -185,6 +185,7 @@ class Span {
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
using size_type = size_t;
using difference_type = ptrdiff_t;
+ using absl_internal_is_view = std::true_type;
static const size_type npos = ~(size_type(0));
diff --git a/absl/types/span_test.cc b/absl/types/span_test.cc
index 29e8681f..e24144dd 100644
--- a/absl/types/span_test.cc
+++ b/absl/types/span_test.cc
@@ -31,10 +31,15 @@
#include "absl/container/fixed_array.h"
#include "absl/container/inlined_vector.h"
#include "absl/hash/hash_testing.h"
+#include "absl/meta/type_traits.h"
#include "absl/strings/str_cat.h"
namespace {
+static_assert(!absl::type_traits_internal::IsOwner<absl::Span<int>>::value &&
+ absl::type_traits_internal::IsView<absl::Span<int>>::value,
+ "Span is a view, not an owner");
+
MATCHER_P(DataIs, data,
absl::StrCat("data() ", negation ? "isn't " : "is ",
testing::PrintToString(data))) {
diff --git a/absl/types/variant.h b/absl/types/variant.h
index ac93464b..56a7e05e 100644
--- a/absl/types/variant.h
+++ b/absl/types/variant.h
@@ -303,11 +303,10 @@ constexpr T& get(variant<Types...>& v) { // NOLINT
}
// 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>
constexpr T&& get(variant<Types...>&& v) {
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.
@@ -318,11 +317,10 @@ constexpr const T& get(const variant<Types...>& v) {
}
// 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>
constexpr const T&& get(const variant<Types...>&& v) {
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.
@@ -333,11 +331,10 @@ constexpr variant_alternative_t<I, variant<Types...>>& get(
}
// 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>
constexpr variant_alternative_t<I, variant<Types...>>&& get(
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.
@@ -348,11 +345,10 @@ constexpr const variant_alternative_t<I, variant<Types...>>& get(
}
// 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>
constexpr const variant_alternative_t<I, variant<Types...>>&& get(
const variant<Types...>&& v) {
- return variant_internal::VariantCoreAccess::CheckedAccess<I>(absl::move(v));
+ return variant_internal::VariantCoreAccess::CheckedAccess<I>(std::move(v));
}
// get_if()
@@ -432,8 +428,8 @@ variant_internal::VisitResult<Visitor, Variants...> visit(Visitor&& vis,
return variant_internal::
VisitIndices<variant_size<absl::decay_t<Variants> >::value...>::Run(
variant_internal::PerformVisitation<Visitor, Variants...>{
- std::forward_as_tuple(absl::forward<Variants>(vars)...),
- absl::forward<Visitor>(vis)},
+ std::forward_as_tuple(std::forward<Variants>(vars)...),
+ std::forward<Visitor>(vis)},
vars.index()...);
}
@@ -504,13 +500,12 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
class T,
std::size_t I = std::enable_if<
variant_internal::IsNeitherSelfNorInPlace<variant,
- absl::decay_t<T>>::value,
- variant_internal::IndexOfConstructedType<variant, T>>::type::value,
+ absl::decay_t<T> >::value,
+ variant_internal::IndexOfConstructedType<variant, T> >::type::value,
class Tj = absl::variant_alternative_t<I, variant>,
- absl::enable_if_t<std::is_constructible<Tj, T>::value>* =
- nullptr>
+ absl::enable_if_t<std::is_constructible<Tj, T>::value>* = nullptr>
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
// direct-initialization.
@@ -524,7 +519,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
constexpr explicit variant(in_place_type_t<T>, Args&&... args)
: Base(variant_internal::EmplaceTag<
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
// and other arguments through direct-initialization.
@@ -539,7 +534,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
Args&&... args)
: Base(variant_internal::EmplaceTag<
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,
// through value-initialization using the provided forwarded arguments.
@@ -548,7 +543,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
variant_internal::VariantAlternativeSfinaeT<I, variant>,
Args...>::value>::type* = nullptr>
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,
// through value-initialization of an initializer list and the provided
@@ -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,
Args&&... args)
: Base(variant_internal::EmplaceTag<I>(), il,
- absl::forward<Args>(args)...) {}
+ std::forward<Args>(args)...) {}
// Destructors
@@ -595,7 +590,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
std::is_nothrow_constructible<Tj, T>::value) {
variant_internal::VisitIndices<sizeof...(Tn) + 1>::Run(
variant_internal::VariantCoreAccess::MakeConversionAssignVisitor(
- this, absl::forward<T>(t)),
+ this, std::forward<T>(t)),
index());
return *this;
@@ -623,7 +618,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
T& emplace(Args&&... args) {
return variant_internal::VariantCoreAccess::Replace<
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
@@ -644,7 +639,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
T& emplace(std::initializer_list<U> il, Args&&... args) {
return variant_internal::VariantCoreAccess::Replace<
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
@@ -663,7 +658,7 @@ class variant<T0, Tn...> : private variant_internal::VariantBase<T0, Tn...> {
Args...>::value>::type* = nullptr>
absl::variant_alternative_t<I, variant>& emplace(Args&&... args) {
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
@@ -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,
Args&&... args) {
return variant_internal::VariantCoreAccess::Replace<I>(
- this, il, absl::forward<Args>(args)...);
+ this, il, std::forward<Args>(args)...);
}
// variant::valueless_by_exception()
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc
index 4cd5b7a3..91b142ca 100644
--- a/absl/types/variant_test.cc
+++ b/absl/types/variant_test.cc
@@ -389,7 +389,7 @@ TEST(VariantTest, TestMoveConstruct) {
using V = variant<MoveOnly<class A>, MoveOnly<class B>, MoveOnly<class C>>;
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);
}
@@ -1209,60 +1209,60 @@ TEST(VariantTest, GetIndex) {
Var v(absl::in_place_index<0>, 0);
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<RValueGetType, int&&>::value));
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;
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<ConstRValueGetType, const int&&>::value));
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");
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<RValueGetType, std::string&&>::value));
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;
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<ConstRValueGetType, const std::string&&>::value));
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;
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<RValueGetType, double&&>::value));
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;
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<ConstRValueGetType, const double&&>::value));
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) {
v.emplace<3>(1);
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<RValueGetType, int&&>::value));
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;
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<ConstRValueGetType, const int&&>::value));
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) {
Var v = 1;
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<RValueGetType, int&&>::value));
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;
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<ConstRValueGetType, const int&&>::value));
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");
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<RValueGetType, std::string&&>::value));
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;
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<ConstRValueGetType, const std::string&&>::value));
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;
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<RValueGetType, double&&>::value));
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;
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<ConstRValueGetType, const double&&>::value));
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) {
int operator()(std::string&&, std::string&&) const { return 3; } // NOLINT
};
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.
EXPECT_EQ(0, absl::visit(Visitor{}, v, v));
- EXPECT_EQ(1, absl::visit(Visitor{}, v, absl::move(v)));
- EXPECT_EQ(2, absl::visit(Visitor{}, absl::move(v), v));
- EXPECT_EQ(3, absl::visit(Visitor{}, absl::move(v), absl::move(v)));
+ EXPECT_EQ(1, absl::visit(Visitor{}, v, std::move(v)));
+ EXPECT_EQ(2, absl::visit(Visitor{}, std::move(v), v));
+ EXPECT_EQ(3, absl::visit(Visitor{}, std::move(v), std::move(v)));
}
TEST(VariantTest, VisitRValueVisitor) {
@@ -1862,12 +1862,12 @@ TEST(VariantTest, VisitResultTypeDifferent) {
(std::is_same<LValue_LValue, decltype(absl::visit(visitor, v))>::value));
EXPECT_TRUE(
(std::is_same<RValue_LValue,
- decltype(absl::visit(visitor, absl::move(v)))>::value));
+ decltype(absl::visit(visitor, std::move(v)))>::value));
EXPECT_TRUE((
std::is_same<LValue_RValue, decltype(absl::visit(Visitor{}, v))>::value));
EXPECT_TRUE(
(std::is_same<RValue_RValue,
- decltype(absl::visit(Visitor{}, absl::move(v)))>::value));
+ decltype(absl::visit(Visitor{}, std::move(v)))>::value));
}
TEST(VariantTest, VisitVariadic) {
@@ -2225,7 +2225,7 @@ TEST(VariantTest, TestMoveSemantics) {
EXPECT_TRUE(absl::holds_alternative<std::unique_ptr<int>>(v));
// 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_NE(nullptr, absl::get<std::unique_ptr<int>>(v2));
EXPECT_EQ(10, *absl::get<std::unique_ptr<int>>(v2));
@@ -2242,7 +2242,7 @@ TEST(VariantTest, TestMoveSemantics) {
EXPECT_EQ("foo", *absl::get<std::unique_ptr<std::string>>(v));
// Move-assign a variant.
- v2 = absl::move(v);
+ v2 = std::move(v);
ASSERT_TRUE(absl::holds_alternative<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));
@@ -2568,7 +2568,7 @@ TEST(VariantTest, TestVectorOfMoveonlyVariant) {
vec.push_back(absl::make_unique<int>(42));
vec.emplace_back("Hello");
vec.reserve(3);
- auto another_vec = absl::move(vec);
+ auto another_vec = std::move(vec);
// As a sanity check, verify vector contents.
ASSERT_EQ(2u, another_vec.size());
EXPECT_EQ(42, *absl::get<std::unique_ptr<int>>(another_vec[0]));