Support forward_list<Incomplete Type>. Patch by Zhihao Yuan!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@200814 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
08356fbee7
commit
a3dc8f3b8b
@ -188,7 +188,6 @@ template <class _Tp, class _VoidPtr> struct __forward_list_node;
|
|||||||
template <class _NodePtr>
|
template <class _NodePtr>
|
||||||
struct __forward_begin_node
|
struct __forward_begin_node
|
||||||
{
|
{
|
||||||
typedef __forward_begin_node __self;
|
|
||||||
typedef _NodePtr pointer;
|
typedef _NodePtr pointer;
|
||||||
|
|
||||||
pointer __next_;
|
pointer __next_;
|
||||||
@ -197,16 +196,22 @@ struct __forward_begin_node
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp, class _VoidPtr>
|
template <class _Tp, class _VoidPtr>
|
||||||
struct __forward_list_node
|
struct _LIBCPP_HIDDEN __begin_node_of
|
||||||
: public __forward_begin_node
|
{
|
||||||
<
|
typedef __forward_begin_node
|
||||||
typename pointer_traits<_VoidPtr>::template
|
<
|
||||||
|
typename pointer_traits<_VoidPtr>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind<__forward_list_node<_Tp, _VoidPtr> >
|
rebind<__forward_list_node<_Tp, _VoidPtr> >
|
||||||
#else
|
#else
|
||||||
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
|
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
|
||||||
#endif
|
#endif
|
||||||
>
|
> type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class _Tp, class _VoidPtr>
|
||||||
|
struct __forward_list_node
|
||||||
|
: public __begin_node_of<_Tp, _VoidPtr>::type
|
||||||
{
|
{
|
||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
|
|
||||||
@ -357,9 +362,9 @@ protected:
|
|||||||
typedef _Tp value_type;
|
typedef _Tp value_type;
|
||||||
typedef _Alloc allocator_type;
|
typedef _Alloc allocator_type;
|
||||||
|
|
||||||
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
|
||||||
typedef __forward_list_node<value_type, void_pointer> __node;
|
typedef __forward_list_node<value_type, void_pointer> __node;
|
||||||
typedef typename __node::__self __begin_node;
|
typedef typename __begin_node_of<value_type, void_pointer>::type __begin_node;
|
||||||
typedef typename allocator_traits<allocator_type>::template
|
typedef typename allocator_traits<allocator_type>::template
|
||||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||||
rebind_alloc<__node>
|
rebind_alloc<__node>
|
||||||
|
@ -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.
|
||||||
|
//
|
||||||
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
|
// <forward_list>
|
||||||
|
|
||||||
|
// class forward_list
|
||||||
|
|
||||||
|
// forward_list();
|
||||||
|
|
||||||
|
#include <forward_list>
|
||||||
|
|
||||||
|
struct X
|
||||||
|
{
|
||||||
|
std::forward_list<X> q;
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user