libstdc++
|
00001 // <forward_list.h> -*- C++ -*- 00002 00003 // Copyright (C) 2008-2015 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file bits/forward_list.h 00026 * This is an internal header file, included by other library headers. 00027 * Do not attempt to use it directly. @headername{forward_list} 00028 */ 00029 00030 #ifndef _FORWARD_LIST_H 00031 #define _FORWARD_LIST_H 1 00032 00033 #pragma GCC system_header 00034 00035 #include <initializer_list> 00036 #include <bits/stl_iterator_base_types.h> 00037 #include <bits/stl_iterator.h> 00038 #include <bits/stl_algobase.h> 00039 #include <bits/stl_function.h> 00040 #include <bits/allocator.h> 00041 #include <ext/alloc_traits.h> 00042 #include <ext/aligned_buffer.h> 00043 00044 namespace std _GLIBCXX_VISIBILITY(default) 00045 { 00046 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER 00047 00048 /** 00049 * @brief A helper basic node class for %forward_list. 00050 * This is just a linked list with nothing inside it. 00051 * There are purely list shuffling utility methods here. 00052 */ 00053 struct _Fwd_list_node_base 00054 { 00055 _Fwd_list_node_base() = default; 00056 00057 _Fwd_list_node_base* _M_next = nullptr; 00058 00059 _Fwd_list_node_base* 00060 _M_transfer_after(_Fwd_list_node_base* __begin, 00061 _Fwd_list_node_base* __end) noexcept 00062 { 00063 _Fwd_list_node_base* __keep = __begin->_M_next; 00064 if (__end) 00065 { 00066 __begin->_M_next = __end->_M_next; 00067 __end->_M_next = _M_next; 00068 } 00069 else 00070 __begin->_M_next = 0; 00071 _M_next = __keep; 00072 return __end; 00073 } 00074 00075 void 00076 _M_reverse_after() noexcept 00077 { 00078 _Fwd_list_node_base* __tail = _M_next; 00079 if (!__tail) 00080 return; 00081 while (_Fwd_list_node_base* __temp = __tail->_M_next) 00082 { 00083 _Fwd_list_node_base* __keep = _M_next; 00084 _M_next = __temp; 00085 __tail->_M_next = __temp->_M_next; 00086 _M_next->_M_next = __keep; 00087 } 00088 } 00089 }; 00090 00091 /** 00092 * @brief A helper node class for %forward_list. 00093 * This is just a linked list with uninitialized storage for a 00094 * data value in each node. 00095 * There is a sorting utility method. 00096 */ 00097 template<typename _Tp> 00098 struct _Fwd_list_node 00099 : public _Fwd_list_node_base 00100 { 00101 _Fwd_list_node() = default; 00102 00103 __gnu_cxx::__aligned_buffer<_Tp> _M_storage; 00104 00105 _Tp* 00106 _M_valptr() noexcept 00107 { return _M_storage._M_ptr(); } 00108 00109 const _Tp* 00110 _M_valptr() const noexcept 00111 { return _M_storage._M_ptr(); } 00112 }; 00113 00114 /** 00115 * @brief A forward_list::iterator. 00116 * 00117 * All the functions are op overloads. 00118 */ 00119 template<typename _Tp> 00120 struct _Fwd_list_iterator 00121 { 00122 typedef _Fwd_list_iterator<_Tp> _Self; 00123 typedef _Fwd_list_node<_Tp> _Node; 00124 00125 typedef _Tp value_type; 00126 typedef _Tp* pointer; 00127 typedef _Tp& reference; 00128 typedef ptrdiff_t difference_type; 00129 typedef std::forward_iterator_tag iterator_category; 00130 00131 _Fwd_list_iterator() noexcept 00132 : _M_node() { } 00133 00134 explicit 00135 _Fwd_list_iterator(_Fwd_list_node_base* __n) noexcept 00136 : _M_node(__n) { } 00137 00138 reference 00139 operator*() const noexcept 00140 { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } 00141 00142 pointer 00143 operator->() const noexcept 00144 { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } 00145 00146 _Self& 00147 operator++() noexcept 00148 { 00149 _M_node = _M_node->_M_next; 00150 return *this; 00151 } 00152 00153 _Self 00154 operator++(int) noexcept 00155 { 00156 _Self __tmp(*this); 00157 _M_node = _M_node->_M_next; 00158 return __tmp; 00159 } 00160 00161 bool 00162 operator==(const _Self& __x) const noexcept 00163 { return _M_node == __x._M_node; } 00164 00165 bool 00166 operator!=(const _Self& __x) const noexcept 00167 { return _M_node != __x._M_node; } 00168 00169 _Self 00170 _M_next() const noexcept 00171 { 00172 if (_M_node) 00173 return _Fwd_list_iterator(_M_node->_M_next); 00174 else 00175 return _Fwd_list_iterator(0); 00176 } 00177 00178 _Fwd_list_node_base* _M_node; 00179 }; 00180 00181 /** 00182 * @brief A forward_list::const_iterator. 00183 * 00184 * All the functions are op overloads. 00185 */ 00186 template<typename _Tp> 00187 struct _Fwd_list_const_iterator 00188 { 00189 typedef _Fwd_list_const_iterator<_Tp> _Self; 00190 typedef const _Fwd_list_node<_Tp> _Node; 00191 typedef _Fwd_list_iterator<_Tp> iterator; 00192 00193 typedef _Tp value_type; 00194 typedef const _Tp* pointer; 00195 typedef const _Tp& reference; 00196 typedef ptrdiff_t difference_type; 00197 typedef std::forward_iterator_tag iterator_category; 00198 00199 _Fwd_list_const_iterator() noexcept 00200 : _M_node() { } 00201 00202 explicit 00203 _Fwd_list_const_iterator(const _Fwd_list_node_base* __n) noexcept 00204 : _M_node(__n) { } 00205 00206 _Fwd_list_const_iterator(const iterator& __iter) noexcept 00207 : _M_node(__iter._M_node) { } 00208 00209 reference 00210 operator*() const noexcept 00211 { return *static_cast<_Node*>(this->_M_node)->_M_valptr(); } 00212 00213 pointer 00214 operator->() const noexcept 00215 { return static_cast<_Node*>(this->_M_node)->_M_valptr(); } 00216 00217 _Self& 00218 operator++() noexcept 00219 { 00220 _M_node = _M_node->_M_next; 00221 return *this; 00222 } 00223 00224 _Self 00225 operator++(int) noexcept 00226 { 00227 _Self __tmp(*this); 00228 _M_node = _M_node->_M_next; 00229 return __tmp; 00230 } 00231 00232 bool 00233 operator==(const _Self& __x) const noexcept 00234 { return _M_node == __x._M_node; } 00235 00236 bool 00237 operator!=(const _Self& __x) const noexcept 00238 { return _M_node != __x._M_node; } 00239 00240 _Self 00241 _M_next() const noexcept 00242 { 00243 if (this->_M_node) 00244 return _Fwd_list_const_iterator(_M_node->_M_next); 00245 else 00246 return _Fwd_list_const_iterator(0); 00247 } 00248 00249 const _Fwd_list_node_base* _M_node; 00250 }; 00251 00252 /** 00253 * @brief Forward list iterator equality comparison. 00254 */ 00255 template<typename _Tp> 00256 inline bool 00257 operator==(const _Fwd_list_iterator<_Tp>& __x, 00258 const _Fwd_list_const_iterator<_Tp>& __y) noexcept 00259 { return __x._M_node == __y._M_node; } 00260 00261 /** 00262 * @brief Forward list iterator inequality comparison. 00263 */ 00264 template<typename _Tp> 00265 inline bool 00266 operator!=(const _Fwd_list_iterator<_Tp>& __x, 00267 const _Fwd_list_const_iterator<_Tp>& __y) noexcept 00268 { return __x._M_node != __y._M_node; } 00269 00270 /** 00271 * @brief Base class for %forward_list. 00272 */ 00273 template<typename _Tp, typename _Alloc> 00274 struct _Fwd_list_base 00275 { 00276 protected: 00277 typedef __alloc_rebind<_Alloc, _Tp> _Tp_alloc_type; 00278 typedef __alloc_rebind<_Alloc, _Fwd_list_node<_Tp>> _Node_alloc_type; 00279 typedef __gnu_cxx::__alloc_traits<_Node_alloc_type> _Node_alloc_traits; 00280 00281 struct _Fwd_list_impl 00282 : public _Node_alloc_type 00283 { 00284 _Fwd_list_node_base _M_head; 00285 00286 _Fwd_list_impl() 00287 : _Node_alloc_type(), _M_head() 00288 { } 00289 00290 _Fwd_list_impl(const _Node_alloc_type& __a) 00291 : _Node_alloc_type(__a), _M_head() 00292 { } 00293 00294 _Fwd_list_impl(_Node_alloc_type&& __a) 00295 : _Node_alloc_type(std::move(__a)), _M_head() 00296 { } 00297 }; 00298 00299 _Fwd_list_impl _M_impl; 00300 00301 public: 00302 typedef _Fwd_list_iterator<_Tp> iterator; 00303 typedef _Fwd_list_const_iterator<_Tp> const_iterator; 00304 typedef _Fwd_list_node<_Tp> _Node; 00305 00306 _Node_alloc_type& 00307 _M_get_Node_allocator() noexcept 00308 { return *static_cast<_Node_alloc_type*>(&this->_M_impl); } 00309 00310 const _Node_alloc_type& 00311 _M_get_Node_allocator() const noexcept 00312 { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); } 00313 00314 _Fwd_list_base() 00315 : _M_impl() { } 00316 00317 _Fwd_list_base(const _Node_alloc_type& __a) 00318 : _M_impl(__a) { } 00319 00320 _Fwd_list_base(_Fwd_list_base&& __lst, const _Node_alloc_type& __a); 00321 00322 _Fwd_list_base(_Fwd_list_base&& __lst) 00323 : _M_impl(std::move(__lst._M_get_Node_allocator())) 00324 { 00325 this->_M_impl._M_head._M_next = __lst._M_impl._M_head._M_next; 00326 __lst._M_impl._M_head._M_next = 0; 00327 } 00328 00329 ~_Fwd_list_base() 00330 { _M_erase_after(&_M_impl._M_head, 0); } 00331 00332 protected: 00333 00334 _Node* 00335 _M_get_node() 00336 { 00337 auto __ptr = _Node_alloc_traits::allocate(_M_get_Node_allocator(), 1); 00338 return std::__addressof(*__ptr); 00339 } 00340 00341 template<typename... _Args> 00342 _Node* 00343 _M_create_node(_Args&&... __args) 00344 { 00345 _Node* __node = this->_M_get_node(); 00346 __try 00347 { 00348 _Tp_alloc_type __a(_M_get_Node_allocator()); 00349 typedef allocator_traits<_Tp_alloc_type> _Alloc_traits; 00350 ::new ((void*)__node) _Node; 00351 _Alloc_traits::construct(__a, __node->_M_valptr(), 00352 std::forward<_Args>(__args)...); 00353 } 00354 __catch(...) 00355 { 00356 this->_M_put_node(__node); 00357 __throw_exception_again; 00358 } 00359 return __node; 00360 } 00361 00362 template<typename... _Args> 00363 _Fwd_list_node_base* 00364 _M_insert_after(const_iterator __pos, _Args&&... __args); 00365 00366 void 00367 _M_put_node(_Node* __p) 00368 { 00369 typedef typename _Node_alloc_traits::pointer _Ptr; 00370 auto __ptr = std::pointer_traits<_Ptr>::pointer_to(*__p); 00371 _Node_alloc_traits::deallocate(_M_get_Node_allocator(), __ptr, 1); 00372 } 00373 00374 _Fwd_list_node_base* 00375 _M_erase_after(_Fwd_list_node_base* __pos); 00376 00377 _Fwd_list_node_base* 00378 _M_erase_after(_Fwd_list_node_base* __pos, 00379 _Fwd_list_node_base* __last); 00380 }; 00381 00382 /** 00383 * @brief A standard container with linear time access to elements, 00384 * and fixed time insertion/deletion at any point in the sequence. 00385 * 00386 * @ingroup sequences 00387 * 00388 * @tparam _Tp Type of element. 00389 * @tparam _Alloc Allocator type, defaults to allocator<_Tp>. 00390 * 00391 * Meets the requirements of a <a href="tables.html#65">container</a>, a 00392 * <a href="tables.html#67">sequence</a>, including the 00393 * <a href="tables.html#68">optional sequence requirements</a> with the 00394 * %exception of @c at and @c operator[]. 00395 * 00396 * This is a @e singly @e linked %list. Traversal up the 00397 * %list requires linear time, but adding and removing elements (or 00398 * @e nodes) is done in constant time, regardless of where the 00399 * change takes place. Unlike std::vector and std::deque, 00400 * random-access iterators are not provided, so subscripting ( @c 00401 * [] ) access is not allowed. For algorithms which only need 00402 * sequential access, this lack makes no difference. 00403 * 00404 * Also unlike the other standard containers, std::forward_list provides 00405 * specialized algorithms %unique to linked lists, such as 00406 * splicing, sorting, and in-place reversal. 00407 */ 00408 template<typename _Tp, typename _Alloc = allocator<_Tp> > 00409 class forward_list : private _Fwd_list_base<_Tp, _Alloc> 00410 { 00411 private: 00412 typedef _Fwd_list_base<_Tp, _Alloc> _Base; 00413 typedef _Fwd_list_node<_Tp> _Node; 00414 typedef _Fwd_list_node_base _Node_base; 00415 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; 00416 typedef typename _Base::_Node_alloc_type _Node_alloc_type; 00417 typedef typename _Base::_Node_alloc_traits _Node_alloc_traits; 00418 typedef __gnu_cxx::__alloc_traits<_Tp_alloc_type> _Alloc_traits; 00419 00420 public: 00421 // types: 00422 typedef _Tp value_type; 00423 typedef typename _Alloc_traits::pointer pointer; 00424 typedef typename _Alloc_traits::const_pointer const_pointer; 00425 typedef value_type& reference; 00426 typedef const value_type& const_reference; 00427 00428 typedef _Fwd_list_iterator<_Tp> iterator; 00429 typedef _Fwd_list_const_iterator<_Tp> const_iterator; 00430 typedef std::size_t size_type; 00431 typedef std::ptrdiff_t difference_type; 00432 typedef _Alloc allocator_type; 00433 00434 // 23.3.4.2 construct/copy/destroy: 00435 00436 /** 00437 * @brief Creates a %forward_list with no elements. 00438 * @param __al An allocator object. 00439 */ 00440 explicit 00441 forward_list(const _Alloc& __al = _Alloc()) 00442 : _Base(_Node_alloc_type(__al)) 00443 { } 00444 00445 /** 00446 * @brief Copy constructor with allocator argument. 00447 * @param __list Input list to copy. 00448 * @param __al An allocator object. 00449 */ 00450 forward_list(const forward_list& __list, const _Alloc& __al) 00451 : _Base(_Node_alloc_type(__al)) 00452 { _M_range_initialize(__list.begin(), __list.end()); } 00453 00454 /** 00455 * @brief Move constructor with allocator argument. 00456 * @param __list Input list to move. 00457 * @param __al An allocator object. 00458 */ 00459 forward_list(forward_list&& __list, const _Alloc& __al) 00460 noexcept(_Node_alloc_traits::_S_always_equal()) 00461 : _Base(std::move(__list), _Node_alloc_type(__al)) 00462 { } 00463 00464 /** 00465 * @brief Creates a %forward_list with default constructed elements. 00466 * @param __n The number of elements to initially create. 00467 * 00468 * This constructor creates the %forward_list with @a __n default 00469 * constructed elements. 00470 */ 00471 explicit 00472 forward_list(size_type __n, const _Alloc& __al = _Alloc()) 00473 : _Base(_Node_alloc_type(__al)) 00474 { _M_default_initialize(__n); } 00475 00476 /** 00477 * @brief Creates a %forward_list with copies of an exemplar element. 00478 * @param __n The number of elements to initially create. 00479 * @param __value An element to copy. 00480 * @param __al An allocator object. 00481 * 00482 * This constructor fills the %forward_list with @a __n copies of 00483 * @a __value. 00484 */ 00485 forward_list(size_type __n, const _Tp& __value, 00486 const _Alloc& __al = _Alloc()) 00487 : _Base(_Node_alloc_type(__al)) 00488 { _M_fill_initialize(__n, __value); } 00489 00490 /** 00491 * @brief Builds a %forward_list from a range. 00492 * @param __first An input iterator. 00493 * @param __last An input iterator. 00494 * @param __al An allocator object. 00495 * 00496 * Create a %forward_list consisting of copies of the elements from 00497 * [@a __first,@a __last). This is linear in N (where N is 00498 * distance(@a __first,@a __last)). 00499 */ 00500 template<typename _InputIterator, 00501 typename = std::_RequireInputIter<_InputIterator>> 00502 forward_list(_InputIterator __first, _InputIterator __last, 00503 const _Alloc& __al = _Alloc()) 00504 : _Base(_Node_alloc_type(__al)) 00505 { _M_range_initialize(__first, __last); } 00506 00507 /** 00508 * @brief The %forward_list copy constructor. 00509 * @param __list A %forward_list of identical element and allocator 00510 * types. 00511 */ 00512 forward_list(const forward_list& __list) 00513 : _Base(_Node_alloc_traits::_S_select_on_copy( 00514 __list._M_get_Node_allocator())) 00515 { _M_range_initialize(__list.begin(), __list.end()); } 00516 00517 /** 00518 * @brief The %forward_list move constructor. 00519 * @param __list A %forward_list of identical element and allocator 00520 * types. 00521 * 00522 * The newly-created %forward_list contains the exact contents of @a 00523 * __list. The contents of @a __list are a valid, but unspecified 00524 * %forward_list. 00525 */ 00526 forward_list(forward_list&& __list) noexcept 00527 : _Base(std::move(__list)) { } 00528 00529 /** 00530 * @brief Builds a %forward_list from an initializer_list 00531 * @param __il An initializer_list of value_type. 00532 * @param __al An allocator object. 00533 * 00534 * Create a %forward_list consisting of copies of the elements 00535 * in the initializer_list @a __il. This is linear in __il.size(). 00536 */ 00537 forward_list(std::initializer_list<_Tp> __il, 00538 const _Alloc& __al = _Alloc()) 00539 : _Base(_Node_alloc_type(__al)) 00540 { _M_range_initialize(__il.begin(), __il.end()); } 00541 00542 /** 00543 * @brief The forward_list dtor. 00544 */ 00545 ~forward_list() noexcept 00546 { } 00547 00548 /** 00549 * @brief The %forward_list assignment operator. 00550 * @param __list A %forward_list of identical element and allocator 00551 * types. 00552 * 00553 * All the elements of @a __list are copied, but unlike the copy 00554 * constructor, the allocator object is not copied. 00555 */ 00556 forward_list& 00557 operator=(const forward_list& __list); 00558 00559 /** 00560 * @brief The %forward_list move assignment operator. 00561 * @param __list A %forward_list of identical element and allocator 00562 * types. 00563 * 00564 * The contents of @a __list are moved into this %forward_list 00565 * (without copying, if the allocators permit it). 00566 * @a __list is a valid, but unspecified %forward_list 00567 */ 00568 forward_list& 00569 operator=(forward_list&& __list) 00570 noexcept(_Node_alloc_traits::_S_nothrow_move()) 00571 { 00572 constexpr bool __move_storage = 00573 _Node_alloc_traits::_S_propagate_on_move_assign() 00574 || _Node_alloc_traits::_S_always_equal(); 00575 _M_move_assign(std::move(__list), 00576 integral_constant<bool, __move_storage>()); 00577 return *this; 00578 } 00579 00580 /** 00581 * @brief The %forward_list initializer list assignment operator. 00582 * @param __il An initializer_list of value_type. 00583 * 00584 * Replace the contents of the %forward_list with copies of the 00585 * elements in the initializer_list @a __il. This is linear in 00586 * __il.size(). 00587 */ 00588 forward_list& 00589 operator=(std::initializer_list<_Tp> __il) 00590 { 00591 assign(__il); 00592 return *this; 00593 } 00594 00595 /** 00596 * @brief Assigns a range to a %forward_list. 00597 * @param __first An input iterator. 00598 * @param __last An input iterator. 00599 * 00600 * This function fills a %forward_list with copies of the elements 00601 * in the range [@a __first,@a __last). 00602 * 00603 * Note that the assignment completely changes the %forward_list and 00604 * that the number of elements of the resulting %forward_list is the 00605 * same as the number of elements assigned. Old data is lost. 00606 */ 00607 template<typename _InputIterator, 00608 typename = std::_RequireInputIter<_InputIterator>> 00609 void 00610 assign(_InputIterator __first, _InputIterator __last) 00611 { 00612 typedef is_assignable<_Tp, decltype(*__first)> __assignable; 00613 _M_assign(__first, __last, __assignable()); 00614 } 00615 00616 /** 00617 * @brief Assigns a given value to a %forward_list. 00618 * @param __n Number of elements to be assigned. 00619 * @param __val Value to be assigned. 00620 * 00621 * This function fills a %forward_list with @a __n copies of the 00622 * given value. Note that the assignment completely changes the 00623 * %forward_list, and that the resulting %forward_list has __n 00624 * elements. Old data is lost. 00625 */ 00626 void 00627 assign(size_type __n, const _Tp& __val) 00628 { _M_assign_n(__n, __val, is_copy_assignable<_Tp>()); } 00629 00630 /** 00631 * @brief Assigns an initializer_list to a %forward_list. 00632 * @param __il An initializer_list of value_type. 00633 * 00634 * Replace the contents of the %forward_list with copies of the 00635 * elements in the initializer_list @a __il. This is linear in 00636 * il.size(). 00637 */ 00638 void 00639 assign(std::initializer_list<_Tp> __il) 00640 { assign(__il.begin(), __il.end()); } 00641 00642 /// Get a copy of the memory allocation object. 00643 allocator_type 00644 get_allocator() const noexcept 00645 { return allocator_type(this->_M_get_Node_allocator()); } 00646 00647 // 23.3.4.3 iterators: 00648 00649 /** 00650 * Returns a read/write iterator that points before the first element 00651 * in the %forward_list. Iteration is done in ordinary element order. 00652 */ 00653 iterator 00654 before_begin() noexcept 00655 { return iterator(&this->_M_impl._M_head); } 00656 00657 /** 00658 * Returns a read-only (constant) iterator that points before the 00659 * first element in the %forward_list. Iteration is done in ordinary 00660 * element order. 00661 */ 00662 const_iterator 00663 before_begin() const noexcept 00664 { return const_iterator(&this->_M_impl._M_head); } 00665 00666 /** 00667 * Returns a read/write iterator that points to the first element 00668 * in the %forward_list. Iteration is done in ordinary element order. 00669 */ 00670 iterator 00671 begin() noexcept 00672 { return iterator(this->_M_impl._M_head._M_next); } 00673 00674 /** 00675 * Returns a read-only (constant) iterator that points to the first 00676 * element in the %forward_list. Iteration is done in ordinary 00677 * element order. 00678 */ 00679 const_iterator 00680 begin() const noexcept 00681 { return const_iterator(this->_M_impl._M_head._M_next); } 00682 00683 /** 00684 * Returns a read/write iterator that points one past the last 00685 * element in the %forward_list. Iteration is done in ordinary 00686 * element order. 00687 */ 00688 iterator 00689 end() noexcept 00690 { return iterator(0); } 00691 00692 /** 00693 * Returns a read-only iterator that points one past the last 00694 * element in the %forward_list. Iteration is done in ordinary 00695 * element order. 00696 */ 00697 const_iterator 00698 end() const noexcept 00699 { return const_iterator(0); } 00700 00701 /** 00702 * Returns a read-only (constant) iterator that points to the 00703 * first element in the %forward_list. Iteration is done in ordinary 00704 * element order. 00705 */ 00706 const_iterator 00707 cbegin() const noexcept 00708 { return const_iterator(this->_M_impl._M_head._M_next); } 00709 00710 /** 00711 * Returns a read-only (constant) iterator that points before the 00712 * first element in the %forward_list. Iteration is done in ordinary 00713 * element order. 00714 */ 00715 const_iterator 00716 cbefore_begin() const noexcept 00717 { return const_iterator(&this->_M_impl._M_head); } 00718 00719 /** 00720 * Returns a read-only (constant) iterator that points one past 00721 * the last element in the %forward_list. Iteration is done in 00722 * ordinary element order. 00723 */ 00724 const_iterator 00725 cend() const noexcept 00726 { return const_iterator(0); } 00727 00728 /** 00729 * Returns true if the %forward_list is empty. (Thus begin() would 00730 * equal end().) 00731 */ 00732 bool 00733 empty() const noexcept 00734 { return this->_M_impl._M_head._M_next == 0; } 00735 00736 /** 00737 * Returns the largest possible number of elements of %forward_list. 00738 */ 00739 size_type 00740 max_size() const noexcept 00741 { return _Node_alloc_traits::max_size(this->_M_get_Node_allocator()); } 00742 00743 // 23.3.4.4 element access: 00744 00745 /** 00746 * Returns a read/write reference to the data at the first 00747 * element of the %forward_list. 00748 */ 00749 reference 00750 front() 00751 { 00752 _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); 00753 return *__front->_M_valptr(); 00754 } 00755 00756 /** 00757 * Returns a read-only (constant) reference to the data at the first 00758 * element of the %forward_list. 00759 */ 00760 const_reference 00761 front() const 00762 { 00763 _Node* __front = static_cast<_Node*>(this->_M_impl._M_head._M_next); 00764 return *__front->_M_valptr(); 00765 } 00766 00767 // 23.3.4.5 modifiers: 00768 00769 /** 00770 * @brief Constructs object in %forward_list at the front of the 00771 * list. 00772 * @param __args Arguments. 00773 * 00774 * This function will insert an object of type Tp constructed 00775 * with Tp(std::forward<Args>(args)...) at the front of the list 00776 * Due to the nature of a %forward_list this operation can 00777 * be done in constant time, and does not invalidate iterators 00778 * and references. 00779 */ 00780 template<typename... _Args> 00781 void 00782 emplace_front(_Args&&... __args) 00783 { this->_M_insert_after(cbefore_begin(), 00784 std::forward<_Args>(__args)...); } 00785 00786 /** 00787 * @brief Add data to the front of the %forward_list. 00788 * @param __val Data to be added. 00789 * 00790 * This is a typical stack operation. The function creates an 00791 * element at the front of the %forward_list and assigns the given 00792 * data to it. Due to the nature of a %forward_list this operation 00793 * can be done in constant time, and does not invalidate iterators 00794 * and references. 00795 */ 00796 void 00797 push_front(const _Tp& __val) 00798 { this->_M_insert_after(cbefore_begin(), __val); } 00799 00800 /** 00801 * 00802 */ 00803 void 00804 push_front(_Tp&& __val) 00805 { this->_M_insert_after(cbefore_begin(), std::move(__val)); } 00806 00807 /** 00808 * @brief Removes first element. 00809 * 00810 * This is a typical stack operation. It shrinks the %forward_list 00811 * by one. Due to the nature of a %forward_list this operation can 00812 * be done in constant time, and only invalidates iterators/references 00813 * to the element being removed. 00814 * 00815 * Note that no data is returned, and if the first element's data 00816 * is needed, it should be retrieved before pop_front() is 00817 * called. 00818 */ 00819 void 00820 pop_front() 00821 { this->_M_erase_after(&this->_M_impl._M_head); } 00822 00823 /** 00824 * @brief Constructs object in %forward_list after the specified 00825 * iterator. 00826 * @param __pos A const_iterator into the %forward_list. 00827 * @param __args Arguments. 00828 * @return An iterator that points to the inserted data. 00829 * 00830 * This function will insert an object of type T constructed 00831 * with T(std::forward<Args>(args)...) after the specified 00832 * location. Due to the nature of a %forward_list this operation can 00833 * be done in constant time, and does not invalidate iterators 00834 * and references. 00835 */ 00836 template<typename... _Args> 00837 iterator 00838 emplace_after(const_iterator __pos, _Args&&... __args) 00839 { return iterator(this->_M_insert_after(__pos, 00840 std::forward<_Args>(__args)...)); } 00841 00842 /** 00843 * @brief Inserts given value into %forward_list after specified 00844 * iterator. 00845 * @param __pos An iterator into the %forward_list. 00846 * @param __val Data to be inserted. 00847 * @return An iterator that points to the inserted data. 00848 * 00849 * This function will insert a copy of the given value after 00850 * the specified location. Due to the nature of a %forward_list this 00851 * operation can be done in constant time, and does not 00852 * invalidate iterators and references. 00853 */ 00854 iterator 00855 insert_after(const_iterator __pos, const _Tp& __val) 00856 { return iterator(this->_M_insert_after(__pos, __val)); } 00857 00858 /** 00859 * 00860 */ 00861 iterator 00862 insert_after(const_iterator __pos, _Tp&& __val) 00863 { return iterator(this->_M_insert_after(__pos, std::move(__val))); } 00864 00865 /** 00866 * @brief Inserts a number of copies of given data into the 00867 * %forward_list. 00868 * @param __pos An iterator into the %forward_list. 00869 * @param __n Number of elements to be inserted. 00870 * @param __val Data to be inserted. 00871 * @return An iterator pointing to the last inserted copy of 00872 * @a val or @a pos if @a n == 0. 00873 * 00874 * This function will insert a specified number of copies of the 00875 * given data after the location specified by @a pos. 00876 * 00877 * This operation is linear in the number of elements inserted and 00878 * does not invalidate iterators and references. 00879 */ 00880 iterator 00881 insert_after(const_iterator __pos, size_type __n, const _Tp& __val); 00882 00883 /** 00884 * @brief Inserts a range into the %forward_list. 00885 * @param __pos An iterator into the %forward_list. 00886 * @param __first An input iterator. 00887 * @param __last An input iterator. 00888 * @return An iterator pointing to the last inserted element or 00889 * @a __pos if @a __first == @a __last. 00890 * 00891 * This function will insert copies of the data in the range 00892 * [@a __first,@a __last) into the %forward_list after the 00893 * location specified by @a __pos. 00894 * 00895 * This operation is linear in the number of elements inserted and 00896 * does not invalidate iterators and references. 00897 */ 00898 template<typename _InputIterator, 00899 typename = std::_RequireInputIter<_InputIterator>> 00900 iterator 00901 insert_after(const_iterator __pos, 00902 _InputIterator __first, _InputIterator __last); 00903 00904 /** 00905 * @brief Inserts the contents of an initializer_list into 00906 * %forward_list after the specified iterator. 00907 * @param __pos An iterator into the %forward_list. 00908 * @param __il An initializer_list of value_type. 00909 * @return An iterator pointing to the last inserted element 00910 * or @a __pos if @a __il is empty. 00911 * 00912 * This function will insert copies of the data in the 00913 * initializer_list @a __il into the %forward_list before the location 00914 * specified by @a __pos. 00915 * 00916 * This operation is linear in the number of elements inserted and 00917 * does not invalidate iterators and references. 00918 */ 00919 iterator 00920 insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) 00921 { return insert_after(__pos, __il.begin(), __il.end()); } 00922 00923 /** 00924 * @brief Removes the element pointed to by the iterator following 00925 * @c pos. 00926 * @param __pos Iterator pointing before element to be erased. 00927 * @return An iterator pointing to the element following the one 00928 * that was erased, or end() if no such element exists. 00929 * 00930 * This function will erase the element at the given position and 00931 * thus shorten the %forward_list by one. 00932 * 00933 * Due to the nature of a %forward_list this operation can be done 00934 * in constant time, and only invalidates iterators/references to 00935 * the element being removed. The user is also cautioned that 00936 * this function only erases the element, and that if the element 00937 * is itself a pointer, the pointed-to memory is not touched in 00938 * any way. Managing the pointer is the user's responsibility. 00939 */ 00940 iterator 00941 erase_after(const_iterator __pos) 00942 { return iterator(this->_M_erase_after(const_cast<_Node_base*> 00943 (__pos._M_node))); } 00944 00945 /** 00946 * @brief Remove a range of elements. 00947 * @param __pos Iterator pointing before the first element to be 00948 * erased. 00949 * @param __last Iterator pointing to one past the last element to be 00950 * erased. 00951 * @return @ __last. 00952 * 00953 * This function will erase the elements in the range 00954 * @a (__pos,__last) and shorten the %forward_list accordingly. 00955 * 00956 * This operation is linear time in the size of the range and only 00957 * invalidates iterators/references to the element being removed. 00958 * The user is also cautioned that this function only erases the 00959 * elements, and that if the elements themselves are pointers, the 00960 * pointed-to memory is not touched in any way. Managing the pointer 00961 * is the user's responsibility. 00962 */ 00963 iterator 00964 erase_after(const_iterator __pos, const_iterator __last) 00965 { return iterator(this->_M_erase_after(const_cast<_Node_base*> 00966 (__pos._M_node), 00967 const_cast<_Node_base*> 00968 (__last._M_node))); } 00969 00970 /** 00971 * @brief Swaps data with another %forward_list. 00972 * @param __list A %forward_list of the same element and allocator 00973 * types. 00974 * 00975 * This exchanges the elements between two lists in constant 00976 * time. Note that the global std::swap() function is 00977 * specialized such that std::swap(l1,l2) will feed to this 00978 * function. 00979 */ 00980 void 00981 swap(forward_list& __list) 00982 noexcept(_Node_alloc_traits::_S_nothrow_swap()) 00983 { 00984 std::swap(this->_M_impl._M_head._M_next, 00985 __list._M_impl._M_head._M_next); 00986 _Node_alloc_traits::_S_on_swap(this->_M_get_Node_allocator(), 00987 __list._M_get_Node_allocator()); 00988 } 00989 00990 /** 00991 * @brief Resizes the %forward_list to the specified number of 00992 * elements. 00993 * @param __sz Number of elements the %forward_list should contain. 00994 * 00995 * This function will %resize the %forward_list to the specified 00996 * number of elements. If the number is smaller than the 00997 * %forward_list's current number of elements the %forward_list 00998 * is truncated, otherwise the %forward_list is extended and the 00999 * new elements are default constructed. 01000 */ 01001 void 01002 resize(size_type __sz); 01003 01004 /** 01005 * @brief Resizes the %forward_list to the specified number of 01006 * elements. 01007 * @param __sz Number of elements the %forward_list should contain. 01008 * @param __val Data with which new elements should be populated. 01009 * 01010 * This function will %resize the %forward_list to the specified 01011 * number of elements. If the number is smaller than the 01012 * %forward_list's current number of elements the %forward_list 01013 * is truncated, otherwise the %forward_list is extended and new 01014 * elements are populated with given data. 01015 */ 01016 void 01017 resize(size_type __sz, const value_type& __val); 01018 01019 /** 01020 * @brief Erases all the elements. 01021 * 01022 * Note that this function only erases 01023 * the elements, and that if the elements themselves are 01024 * pointers, the pointed-to memory is not touched in any way. 01025 * Managing the pointer is the user's responsibility. 01026 */ 01027 void 01028 clear() noexcept 01029 { this->_M_erase_after(&this->_M_impl._M_head, 0); } 01030 01031 // 23.3.4.6 forward_list operations: 01032 01033 /** 01034 * @brief Insert contents of another %forward_list. 01035 * @param __pos Iterator referencing the element to insert after. 01036 * @param __list Source list. 01037 * 01038 * The elements of @a list are inserted in constant time after 01039 * the element referenced by @a pos. @a list becomes an empty 01040 * list. 01041 * 01042 * Requires this != @a x. 01043 */ 01044 void 01045 splice_after(const_iterator __pos, forward_list&& __list) 01046 { 01047 if (!__list.empty()) 01048 _M_splice_after(__pos, __list.before_begin(), __list.end()); 01049 } 01050 01051 void 01052 splice_after(const_iterator __pos, forward_list& __list) 01053 { splice_after(__pos, std::move(__list)); } 01054 01055 /** 01056 * @brief Insert element from another %forward_list. 01057 * @param __pos Iterator referencing the element to insert after. 01058 * @param __list Source list. 01059 * @param __i Iterator referencing the element before the element 01060 * to move. 01061 * 01062 * Removes the element in list @a list referenced by @a i and 01063 * inserts it into the current list after @a pos. 01064 */ 01065 void 01066 splice_after(const_iterator __pos, forward_list&& __list, 01067 const_iterator __i); 01068 01069 void 01070 splice_after(const_iterator __pos, forward_list& __list, 01071 const_iterator __i) 01072 { splice_after(__pos, std::move(__list), __i); } 01073 01074 /** 01075 * @brief Insert range from another %forward_list. 01076 * @param __pos Iterator referencing the element to insert after. 01077 * @param __list Source list. 01078 * @param __before Iterator referencing before the start of range 01079 * in list. 01080 * @param __last Iterator referencing the end of range in list. 01081 * 01082 * Removes elements in the range (__before,__last) and inserts them 01083 * after @a __pos in constant time. 01084 * 01085 * Undefined if @a __pos is in (__before,__last). 01086 */ 01087 void 01088 splice_after(const_iterator __pos, forward_list&&, 01089 const_iterator __before, const_iterator __last) 01090 { _M_splice_after(__pos, __before, __last); } 01091 01092 void 01093 splice_after(const_iterator __pos, forward_list&, 01094 const_iterator __before, const_iterator __last) 01095 { _M_splice_after(__pos, __before, __last); } 01096 01097 /** 01098 * @brief Remove all elements equal to value. 01099 * @param __val The value to remove. 01100 * 01101 * Removes every element in the list equal to @a __val. 01102 * Remaining elements stay in list order. Note that this 01103 * function only erases the elements, and that if the elements 01104 * themselves are pointers, the pointed-to memory is not 01105 * touched in any way. Managing the pointer is the user's 01106 * responsibility. 01107 */ 01108 void 01109 remove(const _Tp& __val); 01110 01111 /** 01112 * @brief Remove all elements satisfying a predicate. 01113 * @param __pred Unary predicate function or object. 01114 * 01115 * Removes every element in the list for which the predicate 01116 * returns true. Remaining elements stay in list order. Note 01117 * that this function only erases the elements, and that if the 01118 * elements themselves are pointers, the pointed-to memory is 01119 * not touched in any way. Managing the pointer is the user's 01120 * responsibility. 01121 */ 01122 template<typename _Pred> 01123 void 01124 remove_if(_Pred __pred); 01125 01126 /** 01127 * @brief Remove consecutive duplicate elements. 01128 * 01129 * For each consecutive set of elements with the same value, 01130 * remove all but the first one. Remaining elements stay in 01131 * list order. Note that this function only erases the 01132 * elements, and that if the elements themselves are pointers, 01133 * the pointed-to memory is not touched in any way. Managing 01134 * the pointer is the user's responsibility. 01135 */ 01136 void 01137 unique() 01138 { unique(std::equal_to<_Tp>()); } 01139 01140 /** 01141 * @brief Remove consecutive elements satisfying a predicate. 01142 * @param __binary_pred Binary predicate function or object. 01143 * 01144 * For each consecutive set of elements [first,last) that 01145 * satisfy predicate(first,i) where i is an iterator in 01146 * [first,last), remove all but the first one. Remaining 01147 * elements stay in list order. Note that this function only 01148 * erases the elements, and that if the elements themselves are 01149 * pointers, the pointed-to memory is not touched in any way. 01150 * Managing the pointer is the user's responsibility. 01151 */ 01152 template<typename _BinPred> 01153 void 01154 unique(_BinPred __binary_pred); 01155 01156 /** 01157 * @brief Merge sorted lists. 01158 * @param __list Sorted list to merge. 01159 * 01160 * Assumes that both @a list and this list are sorted according to 01161 * operator<(). Merges elements of @a __list into this list in 01162 * sorted order, leaving @a __list empty when complete. Elements in 01163 * this list precede elements in @a __list that are equal. 01164 */ 01165 void 01166 merge(forward_list&& __list) 01167 { merge(std::move(__list), std::less<_Tp>()); } 01168 01169 void 01170 merge(forward_list& __list) 01171 { merge(std::move(__list)); } 01172 01173 /** 01174 * @brief Merge sorted lists according to comparison function. 01175 * @param __list Sorted list to merge. 01176 * @param __comp Comparison function defining sort order. 01177 * 01178 * Assumes that both @a __list and this list are sorted according to 01179 * comp. Merges elements of @a __list into this list 01180 * in sorted order, leaving @a __list empty when complete. Elements 01181 * in this list precede elements in @a __list that are equivalent 01182 * according to comp(). 01183 */ 01184 template<typename _Comp> 01185 void 01186 merge(forward_list&& __list, _Comp __comp); 01187 01188 template<typename _Comp> 01189 void 01190 merge(forward_list& __list, _Comp __comp) 01191 { merge(std::move(__list), __comp); } 01192 01193 /** 01194 * @brief Sort the elements of the list. 01195 * 01196 * Sorts the elements of this list in NlogN time. Equivalent 01197 * elements remain in list order. 01198 */ 01199 void 01200 sort() 01201 { sort(std::less<_Tp>()); } 01202 01203 /** 01204 * @brief Sort the forward_list using a comparison function. 01205 * 01206 * Sorts the elements of this list in NlogN time. Equivalent 01207 * elements remain in list order. 01208 */ 01209 template<typename _Comp> 01210 void 01211 sort(_Comp __comp); 01212 01213 /** 01214 * @brief Reverse the elements in list. 01215 * 01216 * Reverse the order of elements in the list in linear time. 01217 */ 01218 void 01219 reverse() noexcept 01220 { this->_M_impl._M_head._M_reverse_after(); } 01221 01222 private: 01223 // Called by the range constructor to implement [23.3.4.2]/9 01224 template<typename _InputIterator> 01225 void 01226 _M_range_initialize(_InputIterator __first, _InputIterator __last); 01227 01228 // Called by forward_list(n,v,a), and the range constructor when it 01229 // turns out to be the same thing. 01230 void 01231 _M_fill_initialize(size_type __n, const value_type& __value); 01232 01233 // Called by splice_after and insert_after. 01234 iterator 01235 _M_splice_after(const_iterator __pos, const_iterator __before, 01236 const_iterator __last); 01237 01238 // Called by forward_list(n). 01239 void 01240 _M_default_initialize(size_type __n); 01241 01242 // Called by resize(sz). 01243 void 01244 _M_default_insert_after(const_iterator __pos, size_type __n); 01245 01246 // Called by operator=(forward_list&&) 01247 void 01248 _M_move_assign(forward_list&& __list, std::true_type) noexcept 01249 { 01250 clear(); 01251 std::swap(this->_M_impl._M_head._M_next, 01252 __list._M_impl._M_head._M_next); 01253 std::__alloc_on_move(this->_M_get_Node_allocator(), 01254 __list._M_get_Node_allocator()); 01255 } 01256 01257 // Called by operator=(forward_list&&) 01258 void 01259 _M_move_assign(forward_list&& __list, std::false_type) 01260 { 01261 if (__list._M_get_Node_allocator() == this->_M_get_Node_allocator()) 01262 _M_move_assign(std::move(__list), std::true_type()); 01263 else 01264 // The rvalue's allocator cannot be moved, or is not equal, 01265 // so we need to individually move each element. 01266 this->assign(std::__make_move_if_noexcept_iterator(__list.begin()), 01267 std::__make_move_if_noexcept_iterator(__list.end())); 01268 } 01269 01270 // Called by assign(_InputIterator, _InputIterator) if _Tp is 01271 // CopyAssignable. 01272 template<typename _InputIterator> 01273 void 01274 _M_assign(_InputIterator __first, _InputIterator __last, true_type) 01275 { 01276 auto __prev = before_begin(); 01277 auto __curr = begin(); 01278 auto __end = end(); 01279 while (__curr != __end && __first != __last) 01280 { 01281 *__curr = *__first; 01282 ++__prev; 01283 ++__curr; 01284 ++__first; 01285 } 01286 if (__first != __last) 01287 insert_after(__prev, __first, __last); 01288 else if (__curr != __end) 01289 erase_after(__prev, __end); 01290 } 01291 01292 // Called by assign(_InputIterator, _InputIterator) if _Tp is not 01293 // CopyAssignable. 01294 template<typename _InputIterator> 01295 void 01296 _M_assign(_InputIterator __first, _InputIterator __last, false_type) 01297 { 01298 clear(); 01299 insert_after(cbefore_begin(), __first, __last); 01300 } 01301 01302 // Called by assign(size_type, const _Tp&) if Tp is CopyAssignable 01303 void 01304 _M_assign_n(size_type __n, const _Tp& __val, true_type) 01305 { 01306 auto __prev = before_begin(); 01307 auto __curr = begin(); 01308 auto __end = end(); 01309 while (__curr != __end && __n > 0) 01310 { 01311 *__curr = __val; 01312 ++__prev; 01313 ++__curr; 01314 --__n; 01315 } 01316 if (__n > 0) 01317 insert_after(__prev, __n, __val); 01318 else if (__curr != __end) 01319 erase_after(__prev, __end); 01320 } 01321 01322 // Called by assign(size_type, const _Tp&) if Tp is non-CopyAssignable 01323 void 01324 _M_assign_n(size_type __n, const _Tp& __val, false_type) 01325 { 01326 clear(); 01327 insert_after(cbefore_begin(), __n, __val); 01328 } 01329 }; 01330 01331 /** 01332 * @brief Forward list equality comparison. 01333 * @param __lx A %forward_list 01334 * @param __ly A %forward_list of the same type as @a __lx. 01335 * @return True iff the elements of the forward lists are equal. 01336 * 01337 * This is an equivalence relation. It is linear in the number of 01338 * elements of the forward lists. Deques are considered equivalent 01339 * if corresponding elements compare equal. 01340 */ 01341 template<typename _Tp, typename _Alloc> 01342 bool 01343 operator==(const forward_list<_Tp, _Alloc>& __lx, 01344 const forward_list<_Tp, _Alloc>& __ly); 01345 01346 /** 01347 * @brief Forward list ordering relation. 01348 * @param __lx A %forward_list. 01349 * @param __ly A %forward_list of the same type as @a __lx. 01350 * @return True iff @a __lx is lexicographically less than @a __ly. 01351 * 01352 * This is a total ordering relation. It is linear in the number of 01353 * elements of the forward lists. The elements must be comparable 01354 * with @c <. 01355 * 01356 * See std::lexicographical_compare() for how the determination is made. 01357 */ 01358 template<typename _Tp, typename _Alloc> 01359 inline bool 01360 operator<(const forward_list<_Tp, _Alloc>& __lx, 01361 const forward_list<_Tp, _Alloc>& __ly) 01362 { return std::lexicographical_compare(__lx.cbegin(), __lx.cend(), 01363 __ly.cbegin(), __ly.cend()); } 01364 01365 /// Based on operator== 01366 template<typename _Tp, typename _Alloc> 01367 inline bool 01368 operator!=(const forward_list<_Tp, _Alloc>& __lx, 01369 const forward_list<_Tp, _Alloc>& __ly) 01370 { return !(__lx == __ly); } 01371 01372 /// Based on operator< 01373 template<typename _Tp, typename _Alloc> 01374 inline bool 01375 operator>(const forward_list<_Tp, _Alloc>& __lx, 01376 const forward_list<_Tp, _Alloc>& __ly) 01377 { return (__ly < __lx); } 01378 01379 /// Based on operator< 01380 template<typename _Tp, typename _Alloc> 01381 inline bool 01382 operator>=(const forward_list<_Tp, _Alloc>& __lx, 01383 const forward_list<_Tp, _Alloc>& __ly) 01384 { return !(__lx < __ly); } 01385 01386 /// Based on operator< 01387 template<typename _Tp, typename _Alloc> 01388 inline bool 01389 operator<=(const forward_list<_Tp, _Alloc>& __lx, 01390 const forward_list<_Tp, _Alloc>& __ly) 01391 { return !(__ly < __lx); } 01392 01393 /// See std::forward_list::swap(). 01394 template<typename _Tp, typename _Alloc> 01395 inline void 01396 swap(forward_list<_Tp, _Alloc>& __lx, 01397 forward_list<_Tp, _Alloc>& __ly) 01398 { __lx.swap(__ly); } 01399 01400 _GLIBCXX_END_NAMESPACE_CONTAINER 01401 } // namespace std 01402 01403 #endif // _FORWARD_LIST_H