From ed77ffbc4d76a227627af5d17056b0726315f235 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 14 Mar 2016 17:58:11 +0000 Subject: [PATCH] Implement LWG#2566: Requirements on the first template parameter of container adaptors git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@263450 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/queue | 2 ++ include/stack | 3 ++- .../priority.queue/types.pass.cpp | 14 +++++++------- .../queue/queue.defn/types.pass.cpp | 14 +++++++------- .../stack/stack.defn/types.pass.cpp | 14 +++++++------- www/cxx1z_status.html | 4 ++-- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/include/queue b/include/queue index 6f49c87ac..81b83a770 100644 --- a/include/queue +++ b/include/queue @@ -198,6 +198,7 @@ public: typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; + static_assert((is_same<_Tp, value_type>::value), "" ); protected: container_type c; @@ -392,6 +393,7 @@ public: typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; + static_assert((is_same<_Tp, value_type>::value), "" ); protected: container_type c; diff --git a/include/stack b/include/stack index 2992b091e..64fd65215 100644 --- a/include/stack +++ b/include/stack @@ -112,7 +112,8 @@ public: typedef typename container_type::reference reference; typedef typename container_type::const_reference const_reference; typedef typename container_type::size_type size_type; - + static_assert((is_same<_Tp, value_type>::value), "" ); + protected: container_type c; diff --git a/test/std/containers/container.adaptors/priority.queue/types.pass.cpp b/test/std/containers/container.adaptors/priority.queue/types.pass.cpp index ade20d47d..802cd0029 100644 --- a/test/std/containers/container.adaptors/priority.queue/types.pass.cpp +++ b/test/std/containers/container.adaptors/priority.queue/types.pass.cpp @@ -48,13 +48,13 @@ struct C int main() { - static_assert((std::is_same::container_type, std::vector >::value), ""); - static_assert((std::is_same >::container_type, std::deque >::value), ""); - static_assert((std::is_same >::value_type, int>::value), ""); - static_assert((std::is_same::reference, std::vector::reference>::value), ""); - static_assert((std::is_same::const_reference, std::vector::const_reference>::value), ""); - static_assert((std::is_same::size_type, std::vector::size_type>::value), ""); - static_assert((std::uses_allocator, std::allocator >::value), ""); + static_assert(( std::is_same::container_type, std::vector >::value), ""); + static_assert(( std::is_same >::container_type, std::deque >::value), ""); + static_assert(( std::is_same >::value_type, int>::value), ""); + static_assert(( std::is_same::reference, std::vector::reference>::value), ""); + static_assert(( std::is_same::const_reference, std::vector::const_reference>::value), ""); + static_assert(( std::is_same::size_type, std::vector::size_type>::value), ""); + static_assert(( std::uses_allocator, std::allocator >::value), ""); static_assert((!std::uses_allocator, std::allocator >::value), ""); test t; } diff --git a/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp b/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp index cc918a361..7f1883a16 100644 --- a/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp +++ b/test/std/containers/container.adaptors/queue/queue.defn/types.pass.cpp @@ -46,13 +46,13 @@ struct C int main() { - static_assert((std::is_same::container_type, std::deque >::value), ""); - static_assert((std::is_same >::container_type, std::vector >::value), ""); - static_assert((std::is_same >::value_type, int>::value), ""); - static_assert((std::is_same::reference, std::deque::reference>::value), ""); - static_assert((std::is_same::const_reference, std::deque::const_reference>::value), ""); - static_assert((std::is_same::size_type, std::deque::size_type>::value), ""); - static_assert((std::uses_allocator, std::allocator >::value), ""); + static_assert(( std::is_same::container_type, std::deque >::value), ""); + static_assert(( std::is_same >::container_type, std::vector >::value), ""); + static_assert(( std::is_same >::value_type, int>::value), ""); + static_assert(( std::is_same::reference, std::deque::reference>::value), ""); + static_assert(( std::is_same::const_reference, std::deque::const_reference>::value), ""); + static_assert(( std::is_same::size_type, std::deque::size_type>::value), ""); + static_assert(( std::uses_allocator, std::allocator >::value), ""); static_assert((!std::uses_allocator, std::allocator >::value), ""); test t; } diff --git a/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp b/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp index afc5ebd53..77a798b83 100644 --- a/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp +++ b/test/std/containers/container.adaptors/stack/stack.defn/types.pass.cpp @@ -47,13 +47,13 @@ struct C int main() { - static_assert((std::is_same::container_type, std::deque >::value), ""); - static_assert((std::is_same >::container_type, std::vector >::value), ""); - static_assert((std::is_same >::value_type, int>::value), ""); - static_assert((std::is_same::reference, std::deque::reference>::value), ""); - static_assert((std::is_same::const_reference, std::deque::const_reference>::value), ""); - static_assert((std::is_same::size_type, std::deque::size_type>::value), ""); - static_assert((std::uses_allocator, std::allocator >::value), ""); + static_assert(( std::is_same::container_type, std::deque >::value), ""); + static_assert(( std::is_same >::container_type, std::vector >::value), ""); + static_assert(( std::is_same >::value_type, int>::value), ""); + static_assert(( std::is_same::reference, std::deque::reference>::value), ""); + static_assert(( std::is_same::const_reference, std::deque::const_reference>::value), ""); + static_assert(( std::is_same::size_type, std::deque::size_type>::value), ""); + static_assert(( std::uses_allocator, std::allocator >::value), ""); static_assert((!std::uses_allocator, std::allocator >::value), ""); test t; } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 9c53cd9ab..0445145d8 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -217,7 +217,7 @@ 2559Error in LWG 2234's resolutionJacksonvilleComplete 2560is_constructible underspecified when applied to a function typeJacksonvilleBroken in 3.6; See r261653. 2565std::function's move constructor should guarantee nothrow for reference_wrappers and function pointersJacksonville - 2566Requirements on the first template parameter of container adaptorsJacksonville + 2566Requirements on the first template parameter of container adaptorsJacksonvilleComplete 2571§[map.modifiers]/2 imposes nonsensical requirement on insert(InputIterator, InputIterator)JacksonvilleComplete 2572The remarks for shared_ptr::operator* should apply to cv-qualified void as wellJacksonvilleComplete 2574[fund.ts.v2] std::experimental::function::operator=(F&&) should be constrainedJacksonville @@ -238,7 +238,7 @@ -

Last Updated: 9-Mar-2016

+

Last Updated: 14-Mar-2016