From a3dc8f3b8bf0a6f1220f673f9f162bf09a743cbc Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 5 Feb 2014 01:44:17 +0000 Subject: [PATCH] Support forward_list. Patch by Zhihao Yuan! git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200814 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/forward_list | 27 +++++++++++-------- .../default_recursive.pass.cpp | 25 +++++++++++++++++ 2 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 test/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp diff --git a/include/forward_list b/include/forward_list index 398226b8..72d31dc7 100644 --- a/include/forward_list +++ b/include/forward_list @@ -188,7 +188,6 @@ template struct __forward_list_node; template struct __forward_begin_node { - typedef __forward_begin_node __self; typedef _NodePtr pointer; pointer __next_; @@ -197,16 +196,22 @@ struct __forward_begin_node }; template -struct __forward_list_node - : public __forward_begin_node - < - typename pointer_traits<_VoidPtr>::template +struct _LIBCPP_HIDDEN __begin_node_of +{ + typedef __forward_begin_node + < + typename pointer_traits<_VoidPtr>::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__forward_list_node<_Tp, _VoidPtr> > + rebind<__forward_list_node<_Tp, _VoidPtr> > #else - rebind<__forward_list_node<_Tp, _VoidPtr> >::other + rebind<__forward_list_node<_Tp, _VoidPtr> >::other #endif - > + > type; +}; + +template +struct __forward_list_node + : public __begin_node_of<_Tp, _VoidPtr>::type { typedef _Tp value_type; @@ -357,9 +362,9 @@ protected: typedef _Tp value_type; typedef _Alloc allocator_type; - typedef typename allocator_traits::void_pointer void_pointer; - typedef __forward_list_node __node; - typedef typename __node::__self __begin_node; + typedef typename allocator_traits::void_pointer void_pointer; + typedef __forward_list_node __node; + typedef typename __begin_node_of::type __begin_node; typedef typename allocator_traits::template #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES rebind_alloc<__node> diff --git a/test/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp b/test/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp new file mode 100644 index 00000000..5ff00e6f --- /dev/null +++ b/test/containers/sequences/forwardlist/forwardlist.cons/default_recursive.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// class forward_list + +// forward_list(); + +#include + +struct X +{ + std::forward_list q; +}; + +int main() +{ +}