diff options
Diffstat (limited to 'absl/types')
-rw-r--r-- | absl/types/internal/variant.h | 8 | ||||
-rw-r--r-- | absl/types/optional.h | 4 | ||||
-rw-r--r-- | absl/types/optional_test.cc | 29 | ||||
-rw-r--r-- | absl/types/variant_test.cc | 10 |
4 files changed, 26 insertions, 25 deletions
diff --git a/absl/types/internal/variant.h b/absl/types/internal/variant.h index 7708e67cb14f..28ae1a5a7e3c 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 c837cddeef48..79475e3ea3b3 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 179bfd66d2fe..d90db9f821b5 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 262bd9446c18..bfb8bd7a0223 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); |