* This is a Standard C++ Library header.
*/
-#ifndef _GLIBCXX_FORWARD_LIST_H
-#define _GLIBCXX_FORWARD_LIST_H 1
+#ifndef _FORWARD_LIST_H
+#define _FORWARD_LIST_H 1
#pragma GCC system_header
typedef typename _Alloc::template rebind<_Fwd_list_node<_Tp>>::other
_Node_alloc_type;
+ typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
+
struct _Fwd_list_impl
: public _Node_alloc_type
{
_Fwd_list_impl _M_impl;
public:
- typedef _Alloc allocator_type;
typedef _Fwd_list_iterator<_Tp> iterator;
typedef _Fwd_list_const_iterator<_Tp> const_iterator;
_M_get_Node_allocator() const
{ return *static_cast<const _Node_alloc_type*>(&this->_M_impl); }
- allocator_type
- get_allocator() const
- { return this->_M_get_Node_allocator(); }
-
_Fwd_list_base()
: _M_impl()
{ this->_M_impl._M_head._M_next = 0; }
- _Fwd_list_base(const allocator_type& __a)
+ _Fwd_list_base(const _Alloc& __a)
: _M_impl(__a)
{ this->_M_impl._M_head._M_next = 0; }
_M_insert_after(const_iterator __pos, _Args&&... __args)
{
_Fwd_list_node_base* __to
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
_Node* __thing = _M_create_node(std::forward<_Args>(__args)...);
__thing->_M_next = __to->_M_next;
__to->_M_next = __thing;
class forward_list : private _Fwd_list_base<_Tp, _Alloc>
{
private:
- typedef _Fwd_list_base<_Tp, _Alloc> _Base;
- typedef _Fwd_list_node<_Tp> _Node;
+ typedef _Fwd_list_base<_Tp, _Alloc> _Base;
+ typedef _Fwd_list_node<_Tp> _Node;
+ typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
public:
// types:
- typedef typename _Alloc::reference reference;
- typedef typename _Alloc::const_reference const_reference;
- typedef _Fwd_list_iterator<_Tp> iterator;
- typedef _Fwd_list_const_iterator<_Tp> const_iterator;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef _Tp value_type;
- typedef typename _Base::allocator_type allocator_type;
- typedef typename _Alloc::pointer pointer;
- typedef typename _Alloc::const_pointer const_pointer;
+ typedef _Tp value_type;
+ typedef typename _Tp_alloc_type::pointer pointer;
+ typedef typename _Tp_alloc_type::const_pointer const_pointer;
+ typedef typename _Tp_alloc_type::reference reference;
+ typedef typename _Tp_alloc_type::const_reference const_reference;
+ typedef _Fwd_list_iterator<_Tp> iterator;
+ typedef _Fwd_list_const_iterator<_Tp> const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef _Alloc allocator_type;
// 23.2.3.1 construct/copy/destroy:
/// Get a copy of the memory allocation object.
allocator_type
get_allocator() const
- { return _Base::get_allocator(); }
+ { return this->_M_get_Node_allocator(); }
// 23.2.3.2 iterators:
insert_after(const_iterator __pos, const _Tp& __val)
{
_Fwd_list_node_base* __to
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
_Node* __thing = _M_create_node(__val);
__thing->_M_next = __to->_M_next;
__to->_M_next = __thing;
insert_after(const_iterator __pos, _Tp&& __val)
{
_Fwd_list_node_base* __to
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
_Node* __thing = _M_create_node(std::move(__val));
__thing->_M_next = __to->_M_next;
__to->_M_next = __thing;
erase_after(const_iterator __pos)
{
_Fwd_list_node_base* __tmp
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
if (__tmp)
return iterator(_Base::_M_erase_after(__tmp));
else
erase_after(const_iterator __pos, iterator __last)
{
_Fwd_list_node_base* __tmp
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
return iterator(_M_erase_after(__tmp, __last._M_node));
}
if (!__list.empty() && &__list != this)
{
_Fwd_list_node_base* __tmp
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
const_iterator __before = __list.cbefore_begin();
- __tmp->_M_transfer_after(const_cast<_Fwd_list_node_base* const>
+ __tmp->_M_transfer_after(const_cast<_Fwd_list_node_base*>
(__before._M_node));
}
}
const_iterator __before, const_iterator __last)
{
_Fwd_list_node_base* __tmp
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
- __tmp->_M_transfer_after(const_cast<_Fwd_list_node_base* const>
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
+ __tmp->_M_transfer_after(const_cast<_Fwd_list_node_base*>
(__before._M_node),
- const_cast<_Fwd_list_node_base* const>
+ const_cast<_Fwd_list_node_base*>
(__last._M_node));
}
#endif // __GXX_EXPERIMENTAL_CXX0X__
-#endif // _GLIBCXX_FORWARD_LIST_H
+#endif // _FORWARD_LIST_H
size_type __n, const _Tp& __val)
{
_Fwd_list_node_base* __to
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
_Fwd_list_node_base* __keep = __to->_M_next;
for (size_type __i = 0; __i < __n; ++__i)
{
_InputIterator __first, _InputIterator __last)
{
_Fwd_list_node_base* __to
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
_Fwd_list_node_base* __keep = __to->_M_next;
_InputIterator __curr = __first;
while (__curr != __last)
insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
{
_Fwd_list_node_base* __to
- = const_cast<_Fwd_list_node_base* const>(__pos._M_node);
+ = const_cast<_Fwd_list_node_base*>(__pos._M_node);
_Fwd_list_node_base* __keep = __to->_M_next;
const _Tp* __item = __il.begin();
while (__item != __il.end())
while (++__next != __last)
{
if (__binary_pred(*__first, *__next))
- erase_after(__first);
+ erase_after(__first);
else
__first = __next;
__next = __first;
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file tests explicit instantiation of library containers
+
+#include <forward_list>
+
+// { dg-do compile }
+
+template class std::forward_list<int>;
--- /dev/null
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// This file tests explicit instantiation of library containers
+
+#include <forward_list>
+
+// { dg-do compile }
+
+// libstdc++/21770
+template class std::forward_list<int, std::allocator<char> >;