From 083d04dd4a62ebbf037079b06e49b323c5e1192a Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 7 Aug 2018 11:43:34 -0700 Subject: Export of internal Abseil changes. -- c1f3a243ff3713917eaf0255c86ddd1b40461ba9 by Abseil Team : Remove stray space. PiperOrigin-RevId: 207753171 -- 4abe43b174f7fafa390d2f6eb96f31977a38fc69 by Shaindel Schwartz : Typo fix. PiperOrigin-RevId: 207572868 -- e7757b409256b025cadba20a84a93cb9dc4319e1 by Abseil Team : Adds backported is_(copy|move)_assignable PiperOrigin-RevId: 207572180 GitOrigin-RevId: c1f3a243ff3713917eaf0255c86ddd1b40461ba9 Change-Id: I1202715e5092b54d5967017728044715d6eb2ec0 --- absl/types/internal/variant.h | 8 ++++---- absl/types/optional.h | 4 ++-- absl/types/optional_test.cc | 29 +++++++++++++++-------------- absl/types/variant_test.cc | 10 +++++----- 4 files changed, 26 insertions(+), 25 deletions(-) (limited to 'absl/types') 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 using VariantMoveAssignBase = absl::conditional_t< - absl::disjunction>, + absl::disjunction>, std::is_move_constructible>, std::is_destructible>>, absl::negation..., - std::is_move_assignable...>>>::value, + absl::is_move_assignable...>>>::value, VariantCopyBase, VariantMoveAssignBaseNontrivial>; // Base that is dependent on whether or not the copy-assign can be trivial. template using VariantCopyAssignBase = absl::conditional_t< - absl::disjunction>, + absl::disjunction>, std::is_copy_constructible>, std::is_destructible>>, absl::negation..., - std::is_copy_assignable...>>>::value, + absl::is_copy_assignable...>>>::value, VariantMoveAssignBase, VariantCopyAssignBaseNontrivial>; template 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 constexpr copy_traits get_assign_copy_traits() { - return std::is_copy_assignable::value && + return absl::is_copy_assignable::value && std::is_copy_constructible::value ? copy_traits::copyable - : std::is_move_assignable::value && + : absl::is_move_assignable::value && std::is_move_constructible::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>::value); - EXPECT_TRUE(std::is_copy_assignable>::value); - EXPECT_FALSE(std::is_copy_assignable>::value); - EXPECT_FALSE(std::is_copy_assignable>::value); - EXPECT_FALSE(std::is_copy_assignable>::value); + EXPECT_FALSE(absl::is_copy_assignable>::value); + EXPECT_TRUE(absl::is_copy_assignable>::value); + EXPECT_FALSE(absl::is_copy_assignable>::value); + EXPECT_FALSE( + absl::is_copy_assignable>::value); + EXPECT_FALSE(absl::is_copy_assignable>::value); EXPECT_TRUE(absl::is_trivially_copy_assignable::value); EXPECT_TRUE(absl::is_trivially_copy_assignable::value); @@ -625,9 +626,9 @@ TEST(optionalTest, CopyAssignment) { }; EXPECT_TRUE(absl::is_trivially_copy_assignable::value); - EXPECT_FALSE(std::is_copy_assignable::value); - EXPECT_FALSE(std::is_copy_assignable::value); - EXPECT_TRUE(std::is_copy_assignable::value); + EXPECT_FALSE(absl::is_copy_assignable::value); + EXPECT_FALSE(absl::is_copy_assignable::value); + EXPECT_TRUE(absl::is_copy_assignable::value); EXPECT_FALSE(absl::is_trivially_copy_assignable::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>::value); - EXPECT_TRUE(std::is_move_assignable>::value); - EXPECT_TRUE(std::is_move_assignable>::value); - EXPECT_TRUE(std::is_move_assignable>::value); - EXPECT_FALSE(std::is_move_assignable>::value); + EXPECT_FALSE(absl::is_move_assignable>::value); + EXPECT_TRUE(absl::is_move_assignable>::value); + EXPECT_TRUE(absl::is_move_assignable>::value); + EXPECT_TRUE(absl::is_move_assignable>::value); + EXPECT_FALSE(absl::is_move_assignable>::value); EXPECT_FALSE( std::is_nothrow_move_assignable>::value); @@ -1619,7 +1620,7 @@ TEST(optionalTest, AssignmentConstraints) { EXPECT_TRUE( (std::is_assignable&, const AnyLike&>::value)); EXPECT_TRUE(std::is_move_assignable>::value); - EXPECT_TRUE(std::is_copy_assignable>::value); + EXPECT_TRUE(absl::is_copy_assignable>::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 struct is_trivially_move_assignable - : std::is_move_assignable>::type {}; + : absl::is_move_assignable>::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>::value); - EXPECT_TRUE(std::is_copy_assignable>::value); + EXPECT_TRUE(absl::is_copy_assignable>::value); EXPECT_TRUE(std::is_move_constructible>::value); - EXPECT_TRUE(std::is_move_assignable>::value); + EXPECT_TRUE(absl::is_move_assignable>::value); EXPECT_TRUE(std::is_move_constructible>>::value); - EXPECT_TRUE(std::is_move_assignable>>::value); + EXPECT_TRUE(absl::is_move_assignable>>::value); EXPECT_FALSE( std::is_copy_constructible>>::value); - EXPECT_FALSE(std::is_copy_assignable>>::value); + EXPECT_FALSE(absl::is_copy_assignable>>::value); EXPECT_FALSE( absl::is_trivially_copy_constructible>::value); -- cgit v1.2.3