summaryrefslogtreecommitdiff
path: root/absl/types
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2018-08-07 11:43:34 -0700
committerGravatar Derek Mauro <dmauro@google.com>2018-08-08 09:53:34 -0400
commit083d04dd4a62ebbf037079b06e49b323c5e1192a (patch)
treec403907fc531e9061cab3007b1cc0d29aa56969c /absl/types
parentbea85b52733022294eef108a2e42d77b616ddca2 (diff)
Export of internal Abseil changes.
-- c1f3a243ff3713917eaf0255c86ddd1b40461ba9 by Abseil Team <absl-team@google.com>: Remove stray space. PiperOrigin-RevId: 207753171 -- 4abe43b174f7fafa390d2f6eb96f31977a38fc69 by Shaindel Schwartz <shaindel@google.com>: Typo fix. PiperOrigin-RevId: 207572868 -- e7757b409256b025cadba20a84a93cb9dc4319e1 by Abseil Team <absl-team@google.com>: Adds backported is_(copy|move)_assignable<T> PiperOrigin-RevId: 207572180 GitOrigin-RevId: c1f3a243ff3713917eaf0255c86ddd1b40461ba9 Change-Id: I1202715e5092b54d5967017728044715d6eb2ec0
Diffstat (limited to 'absl/types')
-rw-r--r--absl/types/internal/variant.h8
-rw-r--r--absl/types/optional.h4
-rw-r--r--absl/types/optional_test.cc29
-rw-r--r--absl/types/variant_test.cc10
4 files changed, 26 insertions, 25 deletions
diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h
index 7708e67c..28ae1a5a 100644
--- a/absl/types/internal/variant.h
+++ b/absl/types/internal/variant.h
@@ -1227,23 +1227,23 @@ using VariantCopyBase = absl::conditional_t<
// Base that is dependent on whether or not the move-assign can be trivial.
template <class... T>
using VariantMoveAssignBase = absl::conditional_t<
- absl::disjunction<absl::conjunction<std::is_move_assignable<Union<T...>>,
+ absl::disjunction<absl::conjunction<absl::is_move_assignable<Union<T...>>,
std::is_move_constructible<Union<T...>>,
std::is_destructible<Union<T...>>>,
absl::negation<absl::conjunction<
std::is_move_constructible<T>...,
- std::is_move_assignable<T>...>>>::value,
+ absl::is_move_assignable<T>...>>>::value,
VariantCopyBase<T...>, VariantMoveAssignBaseNontrivial<T...>>;
// Base that is dependent on whether or not the copy-assign can be trivial.
template <class... T>
using VariantCopyAssignBase = absl::conditional_t<
- absl::disjunction<absl::conjunction<std::is_copy_assignable<Union<T...>>,
+ absl::disjunction<absl::conjunction<absl::is_copy_assignable<Union<T...>>,
std::is_copy_constructible<Union<T...>>,
std::is_destructible<Union<T...>>>,
absl::negation<absl::conjunction<
std::is_copy_constructible<T>...,
- std::is_copy_assignable<T>...>>>::value,
+ absl::is_copy_assignable<T>...>>>::value,
VariantMoveAssignBase<T...>, VariantCopyAssignBaseNontrivial<T...>>;
template <class... T>
diff --git a/absl/types/optional.h b/absl/types/optional.h
index c837cdde..79475e3e 100644
--- a/absl/types/optional.h
+++ b/absl/types/optional.h
@@ -411,10 +411,10 @@ constexpr copy_traits get_ctor_copy_traits() {
template <typename T>
constexpr copy_traits get_assign_copy_traits() {
- return std::is_copy_assignable<T>::value &&
+ return absl::is_copy_assignable<T>::value &&
std::is_copy_constructible<T>::value
? copy_traits::copyable
- : std::is_move_assignable<T>::value &&
+ : absl::is_move_assignable<T>::value &&
std::is_move_constructible<T>::value
? copy_traits::movable
: copy_traits::non_movable;
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index 179bfd66..d90db9f8 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -607,11 +607,12 @@ TEST(optionalTest, CopyAssignment) {
opt2_to_empty = empty;
EXPECT_FALSE(opt2_to_empty);
- EXPECT_FALSE(std::is_copy_assignable<absl::optional<const int>>::value);
- EXPECT_TRUE(std::is_copy_assignable<absl::optional<Copyable>>::value);
- EXPECT_FALSE(std::is_copy_assignable<absl::optional<MoveableThrow>>::value);
- EXPECT_FALSE(std::is_copy_assignable<absl::optional<MoveableNoThrow>>::value);
- EXPECT_FALSE(std::is_copy_assignable<absl::optional<NonMovable>>::value);
+ EXPECT_FALSE(absl::is_copy_assignable<absl::optional<const int>>::value);
+ EXPECT_TRUE(absl::is_copy_assignable<absl::optional<Copyable>>::value);
+ EXPECT_FALSE(absl::is_copy_assignable<absl::optional<MoveableThrow>>::value);
+ EXPECT_FALSE(
+ absl::is_copy_assignable<absl::optional<MoveableNoThrow>>::value);
+ EXPECT_FALSE(absl::is_copy_assignable<absl::optional<NonMovable>>::value);
EXPECT_TRUE(absl::is_trivially_copy_assignable<int>::value);
EXPECT_TRUE(absl::is_trivially_copy_assignable<volatile int>::value);
@@ -625,9 +626,9 @@ TEST(optionalTest, CopyAssignment) {
};
EXPECT_TRUE(absl::is_trivially_copy_assignable<Trivial>::value);
- EXPECT_FALSE(std::is_copy_assignable<const Trivial>::value);
- EXPECT_FALSE(std::is_copy_assignable<volatile Trivial>::value);
- EXPECT_TRUE(std::is_copy_assignable<NonTrivial>::value);
+ EXPECT_FALSE(absl::is_copy_assignable<const Trivial>::value);
+ EXPECT_FALSE(absl::is_copy_assignable<volatile Trivial>::value);
+ EXPECT_TRUE(absl::is_copy_assignable<NonTrivial>::value);
EXPECT_FALSE(absl::is_trivially_copy_assignable<NonTrivial>::value);
// std::optional doesn't support volatile nontrivial types.
@@ -695,11 +696,11 @@ TEST(optionalTest, MoveAssignment) {
EXPECT_EQ(1, listener.volatile_move_assign);
}
#endif // ABSL_HAVE_STD_OPTIONAL
- EXPECT_FALSE(std::is_move_assignable<absl::optional<const int>>::value);
- EXPECT_TRUE(std::is_move_assignable<absl::optional<Copyable>>::value);
- EXPECT_TRUE(std::is_move_assignable<absl::optional<MoveableThrow>>::value);
- EXPECT_TRUE(std::is_move_assignable<absl::optional<MoveableNoThrow>>::value);
- EXPECT_FALSE(std::is_move_assignable<absl::optional<NonMovable>>::value);
+ EXPECT_FALSE(absl::is_move_assignable<absl::optional<const int>>::value);
+ EXPECT_TRUE(absl::is_move_assignable<absl::optional<Copyable>>::value);
+ EXPECT_TRUE(absl::is_move_assignable<absl::optional<MoveableThrow>>::value);
+ EXPECT_TRUE(absl::is_move_assignable<absl::optional<MoveableNoThrow>>::value);
+ EXPECT_FALSE(absl::is_move_assignable<absl::optional<NonMovable>>::value);
EXPECT_FALSE(
std::is_nothrow_move_assignable<absl::optional<MoveableThrow>>::value);
@@ -1619,7 +1620,7 @@ TEST(optionalTest, AssignmentConstraints) {
EXPECT_TRUE(
(std::is_assignable<absl::optional<AnyLike>&, const AnyLike&>::value));
EXPECT_TRUE(std::is_move_assignable<absl::optional<AnyLike>>::value);
- EXPECT_TRUE(std::is_copy_assignable<absl::optional<AnyLike>>::value);
+ EXPECT_TRUE(absl::is_copy_assignable<absl::optional<AnyLike>>::value);
}
} // namespace
diff --git a/absl/types/variant_test.cc b/absl/types/variant_test.cc
index 262bd944..bfb8bd7a 100644
--- a/absl/types/variant_test.cc
+++ b/absl/types/variant_test.cc
@@ -403,7 +403,7 @@ struct is_trivially_move_constructible
template <class T>
struct is_trivially_move_assignable
- : std::is_move_assignable<SingleUnion<T>>::type {};
+ : absl::is_move_assignable<SingleUnion<T>>::type {};
TEST(VariantTest, NothrowMoveConstructible) {
// Verify that variant is nothrow move constructible iff its template
@@ -2439,14 +2439,14 @@ TEST(VariantTest, TestMoveConversionViaConvertVariantTo) {
TEST(VariantTest, TestCopyAndMoveTypeTraits) {
EXPECT_TRUE(std::is_copy_constructible<variant<std::string>>::value);
- EXPECT_TRUE(std::is_copy_assignable<variant<std::string>>::value);
+ EXPECT_TRUE(absl::is_copy_assignable<variant<std::string>>::value);
EXPECT_TRUE(std::is_move_constructible<variant<std::string>>::value);
- EXPECT_TRUE(std::is_move_assignable<variant<std::string>>::value);
+ EXPECT_TRUE(absl::is_move_assignable<variant<std::string>>::value);
EXPECT_TRUE(std::is_move_constructible<variant<std::unique_ptr<int>>>::value);
- EXPECT_TRUE(std::is_move_assignable<variant<std::unique_ptr<int>>>::value);
+ EXPECT_TRUE(absl::is_move_assignable<variant<std::unique_ptr<int>>>::value);
EXPECT_FALSE(
std::is_copy_constructible<variant<std::unique_ptr<int>>>::value);
- EXPECT_FALSE(std::is_copy_assignable<variant<std::unique_ptr<int>>>::value);
+ EXPECT_FALSE(absl::is_copy_assignable<variant<std::unique_ptr<int>>>::value);
EXPECT_FALSE(
absl::is_trivially_copy_constructible<variant<std::string>>::value);