[libcxx] r241190 - Noticed that std::allocator<const T> was missing the definition for is_always_equal. Fixed this, and added a test for it.
Marshall Clow
mclow.lists at gmail.com
Wed Jul 1 14:23:40 PDT 2015
Author: marshall
Date: Wed Jul 1 16:23:40 2015
New Revision: 241190
URL: http://llvm.org/viewvc/llvm-project?rev=241190&view=rev
Log:
Noticed that std::allocator<const T> was missing the definition for is_always_equal. Fixed this, and added a test for it.
Modified:
libcxx/trunk/include/memory
libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
libcxx/trunk/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=241190&r1=241189&r2=241190&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed Jul 1 16:23:40 2015
@@ -1787,6 +1787,7 @@ public:
typedef const _Tp value_type;
typedef true_type propagate_on_container_move_assignment;
+ typedef true_type is_always_equal;
template <class _Up> struct rebind {typedef allocator<_Up> other;};
Modified: libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp?rev=241190&r1=241189&r2=241190&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/allocator.traits/allocator.traits.types/is_always_equal.pass.cpp Wed Jul 1 16:23:40 2015
@@ -45,4 +45,8 @@ int main()
static_assert((std::is_same<std::allocator_traits<A<char> >::is_always_equal, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<B<char> >::is_always_equal, std::true_type>::value), "");
static_assert((std::is_same<std::allocator_traits<C<char> >::is_always_equal, std::false_type>::value), "");
+
+ static_assert((std::is_same<std::allocator_traits<A<const char> >::is_always_equal, std::true_type>::value), "");
+ static_assert((std::is_same<std::allocator_traits<B<const char> >::is_always_equal, std::true_type>::value), "");
+ static_assert((std::is_same<std::allocator_traits<C<const char> >::is_always_equal, std::false_type>::value), "");
}
Modified: libcxx/trunk/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp?rev=241190&r1=241189&r2=241190&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/memory/default.allocator/allocator_types.pass.cpp Wed Jul 1 16:23:40 2015
@@ -22,6 +22,7 @@
// typedef typename add_lvalue_reference<T>::type reference;
// typedef typename add_lvalue_reference<const T>::type const_reference;
// typedef T value_type;
+// typedef true_type is_always_equal;
//
// template <class U> struct rebind {typedef allocator<U> other;};
// ...
@@ -42,6 +43,10 @@ int main()
static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
std::allocator<int> >::value), "");
+
+ static_assert((std::is_same<std::allocator< char>::is_always_equal, std::true_type>::value), "");
+ static_assert((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
+
std::allocator<char> a;
std::allocator<char> a2 = a;
a2 = a;
More information about the cfe-commits
mailing list