diff options
Diffstat (limited to 'absl')
-rw-r--r-- | absl/algorithm/container.h | 2 | ||||
-rw-r--r-- | absl/container/inlined_vector_test.cc | 1 | ||||
-rw-r--r-- | absl/meta/type_traits.h | 5 | ||||
-rw-r--r-- | absl/meta/type_traits_test.cc | 4 |
4 files changed, 8 insertions, 4 deletions
diff --git a/absl/algorithm/container.h b/absl/algorithm/container.h index acddec484b0a..6af8c09799e5 100644 --- a/absl/algorithm/container.h +++ b/absl/algorithm/container.h @@ -314,7 +314,7 @@ container_algorithm_internal::ContainerDifferenceType<const C> c_count_if( // c_mismatch() // -// Container-based version of the <algorithm> `std::mismatchf()` function to +// Container-based version of the <algorithm> `std::mismatch()` function to // return the first element where two ordered containers differ. template <typename C1, typename C2> container_algorithm_internal::ContainerIterPairType<C1, C2> diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc index f81fad569dcd..196a1bed976c 100644 --- a/absl/container/inlined_vector_test.cc +++ b/absl/container/inlined_vector_test.cc @@ -1788,5 +1788,4 @@ TEST(AllocatorSupportTest, SizeAllocConstructor) { EXPECT_THAT(v, AllOf(SizeIs(len), Each(0))); } } - } // anonymous namespace diff --git a/absl/meta/type_traits.h b/absl/meta/type_traits.h index c3e01fe2990c..8d3264f100db 100644 --- a/absl/meta/type_traits.h +++ b/absl/meta/type_traits.h @@ -263,8 +263,9 @@ struct is_trivially_copy_constructible // `is_trivially_assignable<T&, const T&>`. template <typename T> struct is_trivially_copy_assignable - : std::integral_constant<bool, __has_trivial_assign(T) && - std::is_copy_assignable<T>::value> { + : std::integral_constant< + bool, __has_trivial_assign(typename std::remove_reference<T>::type) && + std::is_copy_assignable<T>::value> { #ifdef ABSL_HAVE_STD_IS_TRIVIALLY_ASSIGNABLE private: static constexpr bool compliant = diff --git a/absl/meta/type_traits_test.cc b/absl/meta/type_traits_test.cc index c44d1c5ff850..9dd95429a5a1 100644 --- a/absl/meta/type_traits_test.cc +++ b/absl/meta/type_traits_test.cc @@ -528,6 +528,10 @@ TEST(TypeTraitsTest, TestTrivialCopyAssign) { // Verify that arrays are not trivially copy assignable using int10 = int[10]; EXPECT_FALSE(absl::is_trivially_copy_assignable<int10>::value); + + // Verify that references are handled correctly + EXPECT_TRUE(absl::is_trivially_copy_assignable<Trivial&&>::value); + EXPECT_TRUE(absl::is_trivially_copy_assignable<Trivial&>::value); } #define ABSL_INTERNAL_EXPECT_ALIAS_EQUIVALENCE(trait_name, ...) \ |