00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _FORWARD_LIST_H
00030 #define _FORWARD_LIST_H 1
00031
00032 #pragma GCC system_header
00033
00034 #ifndef __GXX_EXPERIMENTAL_CXX0X__
00035 # include <c++0x_warning.h>
00036 #else
00037
00038 #include <memory>
00039 #include <initializer_list>
00040 #include <ext/cast.h>
00041
00042 _GLIBCXX_BEGIN_NAMESPACE(std)
00043
00044 using __gnu_cxx::__static_pointer_cast;
00045 using __gnu_cxx::__const_pointer_cast;
00046
00047
00048
00049
00050
00051
00052 template<typename _Alloc>
00053 struct _Fwd_list_node_base
00054 {
00055
00056 typedef typename _Alloc::template rebind<_Fwd_list_node_base<_Alloc> >
00057 ::other::pointer _Pointer;
00058 typedef typename _Alloc::template rebind<_Fwd_list_node_base<_Alloc> >
00059 ::other::const_pointer _Const_pointer;
00060
00061 _Pointer _M_next;
00062
00063 _Fwd_list_node_base() : _M_next(0) { }
00064
00065 static void
00066 swap(_Fwd_list_node_base& __x, _Fwd_list_node_base& __y)
00067 { std::swap(__x._M_next, __y._M_next); }
00068
00069 void
00070 _M_transfer_after(_Pointer __bbegin);
00071
00072 void
00073 _M_transfer_after(_Pointer __bbegin, _Pointer __bend);
00074
00075 void
00076 _M_reverse_after();
00077 };
00078
00079
00080
00081
00082
00083
00084 template<typename _Tp, typename _Alloc>
00085 struct _Fwd_list_node : public _Fwd_list_node_base<_Alloc>
00086 {
00087 typedef typename _Alloc::template rebind<_Fwd_list_node<_Tp, _Alloc> >
00088 ::other::pointer _Pointer;
00089
00090 template<typename... _Args>
00091 _Fwd_list_node(_Args&&... __args)
00092 : _Fwd_list_node_base<_Alloc>(),
00093 _M_value(std::forward<_Args>(__args)...) { }
00094
00095 template<typename _Comp>
00096 void
00097 _M_sort_after(_Comp __comp);
00098
00099 _Tp _M_value;
00100 };
00101
00102
00103
00104
00105
00106
00107 template<typename _Tp, typename _Alloc>
00108 struct _Fwd_list_iterator
00109 {
00110 typedef _Fwd_list_iterator<_Tp, _Alloc> _Self;
00111 typedef _Fwd_list_node<_Tp, _Alloc> _Node;
00112 typedef _Fwd_list_node_base<_Alloc> _Node_base;
00113
00114 typedef _Tp value_type;
00115 typedef typename _Alloc::pointer pointer;
00116 typedef typename _Alloc::reference reference;
00117 typedef typename _Alloc::difference_type difference_type;
00118 typedef std::forward_iterator_tag iterator_category;
00119
00120 _Fwd_list_iterator() : _M_node() { }
00121
00122 explicit
00123 _Fwd_list_iterator(typename _Node_base::_Pointer __n)
00124 : _M_node(__n) { }
00125
00126 reference
00127 operator*() const
00128 { return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
00129
00130 pointer
00131 operator->() const
00132 { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
00133
00134 _Self&
00135 operator++()
00136 {
00137 _M_node = _M_node->_M_next;
00138 return *this;
00139 }
00140
00141 _Self
00142 operator++(int)
00143 {
00144 _Self __tmp(*this);
00145 _M_node = _M_node->_M_next;
00146 return __tmp;
00147 }
00148
00149 bool
00150 operator==(const _Self& __x) const
00151 { return _M_node == __x._M_node; }
00152
00153 bool
00154 operator!=(const _Self& __x) const
00155 { return _M_node != __x._M_node; }
00156
00157 _Self
00158 _M_next() const
00159 {
00160 if (_M_node)
00161 return _Fwd_list_iterator(_M_node->_M_next);
00162 else
00163 return _Fwd_list_iterator(0);
00164 }
00165
00166 typename _Node_base::_Pointer _M_node;
00167 };
00168
00169
00170
00171
00172
00173
00174 template<typename _Tp, typename _Alloc>
00175 struct _Fwd_list_const_iterator
00176 {
00177 typedef _Fwd_list_const_iterator<_Tp, _Alloc> _Self;
00178 typedef const _Fwd_list_node<_Tp, _Alloc> _Node;
00179 typedef const _Fwd_list_node_base<_Alloc> _Node_base;
00180 typedef _Fwd_list_iterator<_Tp, _Alloc> iterator;
00181
00182 typedef _Tp value_type;
00183 typedef typename _Alloc::const_pointer pointer;
00184 typedef typename _Alloc::const_reference reference;
00185 typedef typename _Alloc::difference_type difference_type;
00186 typedef std::forward_iterator_tag iterator_category;
00187
00188 _Fwd_list_const_iterator() : _M_node() { }
00189
00190 explicit
00191 _Fwd_list_const_iterator(typename _Node_base::_Const_pointer __n)
00192 : _M_node(__n) { }
00193
00194 _Fwd_list_const_iterator(const iterator& __iter)
00195 : _M_node(__iter._M_node) { }
00196
00197 reference
00198 operator*() const
00199 { return __static_pointer_cast<_Node*>(_M_node)->_M_value; }
00200
00201 pointer
00202 operator->() const
00203 { return &__static_pointer_cast<_Node*>(_M_node)->_M_value; }
00204
00205 _Self&
00206 operator++()
00207 {
00208 _M_node = _M_node->_M_next;
00209 return *this;
00210 }
00211
00212 _Self
00213 operator++(int)
00214 {
00215 _Self __tmp(*this);
00216 _M_node = _M_node->_M_next;
00217 return __tmp;
00218 }
00219
00220 bool
00221 operator==(const _Self& __x) const
00222 { return _M_node == __x._M_node; }
00223
00224 bool
00225 operator!=(const _Self& __x) const
00226 { return _M_node != __x._M_node; }
00227
00228 _Self
00229 _M_next() const
00230 {
00231 if (this->_M_node)
00232 return _Fwd_list_const_iterator(_M_node->_M_next);
00233 else
00234 return _Fwd_list_const_iterator(0);
00235 }
00236
00237 typename _Node_base::_Const_pointer _M_node;
00238 };
00239
00240
00241
00242
00243 template<typename _Tp, typename _Alloc>
00244 inline bool
00245 operator==(const _Fwd_list_iterator<_Tp, _Alloc>& __x,
00246 const _Fwd_list_const_iterator<_Tp, _Alloc>& __y)
00247 { return __x._M_node == __y._M_node; }
00248
00249
00250
00251
00252 template<typename _Tp, typename _Alloc>
00253 inline bool
00254 operator!=(const _Fwd_list_iterator<_Tp, _Alloc>& __x,
00255 const _Fwd_list_const_iterator<_Tp, _Alloc>& __y)
00256 { return __x._M_node != __y._M_node; }
00257
00258
00259
00260
00261 template<typename _Tp, typename _Alloc>
00262 struct _Fwd_list_base
00263 {
00264 protected:
00265 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
00266
00267 typedef typename _Alloc::template
00268 rebind<_Fwd_list_node<_Tp, _Tp_alloc_type>>::other _Node_alloc_type;
00269
00270 struct _Fwd_list_impl
00271 : public _Node_alloc_type
00272 {
00273 _Fwd_list_node_base<_Tp_alloc_type> _M_head;
00274
00275 _Fwd_list_impl()
00276 : _Node_alloc_type(), _M_head()
00277 { }
00278
00279 _Fwd_list_impl(const _Node_alloc_type& __a)
00280 : _Node_alloc_type(__a), _M_head()
00281 { }
00282 };
00283
00284 _Fwd_list_impl _M_impl;
00285
00286 public:
00287 typedef _Fwd_list_iterator<_Tp, _Tp_alloc_type> iterator;
00288 typedef _Fwd_list_const_iterator<_Tp, _Tp_alloc_type> const_iterator;
00289
00290 typedef _Fwd_list_node<_Tp, _Tp_alloc_type> _Node;
00291 typedef _Fwd_list_node_base<_Tp_alloc_type> _Node_base;
00292
00293 _Node_alloc_type&
00294 _M_get_Node_allocator()
00295 { return *static_cast<_Node_alloc_type*>(&this->_M_impl); }
00296
00297 const _Node_alloc_type&
00298 _M_get_Node_allocator() const
00299 { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); }
00300
00301 _Fwd_list_base()
00302 : _M_impl()
00303 { this->_M_impl._M_head._M_next = 0; }
00304
00305 _Fwd_list_base(const _Alloc& __a)
00306 : _M_impl(__a)
00307 { this->_M_impl._M_head._M_next = 0; }
00308
00309 _Fwd_list_base(const _Fwd_list_base& __lst, const _Alloc& __a);
00310
00311 _Fwd_list_base(_Fwd_list_base&& __lst, const _Alloc& __a)
00312 : _M_impl(__a)
00313 { _Node_base::swap(this->_M_impl._M_head,
00314 __lst._M_impl._M_head); }
00315
00316 _Fwd_list_base(_Fwd_list_base&& __lst)
00317 : _M_impl(__lst._M_get_Node_allocator())
00318 { _Node_base::swap(this->_M_impl._M_head,
00319 __lst._M_impl._M_head); }
00320
00321 ~_Fwd_list_base()
00322 { _M_erase_after(&_M_impl._M_head, 0); }
00323
00324 protected:
00325
00326 typename _Node::_Pointer
00327 _M_get_node()
00328 { return _M_get_Node_allocator().allocate(1); }
00329
00330 template<typename... _Args>
00331 typename _Node::_Pointer
00332 _M_create_node(_Args&&... __args)
00333 {
00334 typename _Node::_Pointer __node = this->_M_get_node();
00335 __try
00336 {
00337 _M_get_Node_allocator().construct(__node,
00338 std::forward<_Args>(__args)...);
00339 __node->_M_next = 0;
00340 }
00341 __catch(...)
00342 {
00343 this->_M_put_node(__node);
00344 __throw_exception_again;
00345 }
00346 return __node;
00347 }
00348
00349 template<typename... _Args>
00350 typename _Node_base::_Pointer
00351 _M_insert_after(const_iterator __pos, _Args&&... __args);
00352
00353 void
00354 _M_put_node(typename _Node::_Pointer __p)
00355 { _M_get_Node_allocator().deallocate(__p, 1); }
00356
00357 typename _Node_base::_Pointer
00358 _M_erase_after(typename _Node_base::_Pointer __pos);
00359
00360 typename _Node_base::_Pointer
00361 _M_erase_after(typename _Node_base::_Pointer __pos,
00362 typename _Node_base::_Pointer __last);
00363 };
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396 template<typename _Tp, typename _Alloc = allocator<_Tp> >
00397 class forward_list : private _Fwd_list_base<_Tp, _Alloc>
00398 {
00399 private:
00400 typedef _Fwd_list_base<_Tp, _Alloc> _Base;
00401 typedef typename _Base::_Node _Node;
00402 typedef typename _Base::_Node_base _Node_base;
00403 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
00404
00405 public:
00406
00407 typedef _Tp value_type;
00408 typedef typename _Tp_alloc_type::pointer pointer;
00409 typedef typename _Tp_alloc_type::const_pointer const_pointer;
00410 typedef typename _Tp_alloc_type::reference reference;
00411 typedef typename _Tp_alloc_type::const_reference const_reference;
00412
00413 typedef typename _Base::iterator iterator;
00414 typedef typename _Base::const_iterator const_iterator;
00415 typedef std::size_t size_type;
00416 typedef std::ptrdiff_t difference_type;
00417 typedef _Alloc allocator_type;
00418
00419
00420
00421
00422
00423
00424
00425 explicit
00426 forward_list(const _Alloc& __al = _Alloc())
00427 : _Base(__al)
00428 { }
00429
00430
00431
00432
00433
00434
00435 forward_list(const forward_list& __list, const _Alloc& __al)
00436 : _Base(__list, __al)
00437 { }
00438
00439
00440
00441
00442
00443
00444 forward_list(forward_list&& __list, const _Alloc& __al)
00445 : _Base(std::forward<_Base>(__list), __al)
00446 { }
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456 explicit
00457 forward_list(size_type __n)
00458 : _Base()
00459 { _M_fill_initialize(__n, value_type()); }
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470 forward_list(size_type __n, const _Tp& __value,
00471 const _Alloc& __al = _Alloc())
00472 : _Base(__al)
00473 { _M_fill_initialize(__n, __value); }
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485 template<typename _InputIterator>
00486 forward_list(_InputIterator __first, _InputIterator __last,
00487 const _Alloc& __al = _Alloc())
00488 : _Base(__al)
00489 {
00490
00491 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
00492 _M_initialize_dispatch(__first, __last, _Integral());
00493 }
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503 forward_list(const forward_list& __list)
00504 : _Base(__list.get_allocator())
00505 { _M_initialize_dispatch(__list.begin(), __list.end(), __false_type()); }
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516 forward_list(forward_list&& __list)
00517 : _Base(std::forward<_Base>(__list)) { }
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527 forward_list(std::initializer_list<_Tp> __il,
00528 const _Alloc& __al = _Alloc())
00529 : _Base(__al)
00530 { _M_initialize_dispatch(__il.begin(), __il.end(), __false_type()); }
00531
00532
00533
00534
00535 ~forward_list()
00536 { _M_erase_after(&this->_M_impl._M_head, 0); }
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546 forward_list&
00547 operator=(const forward_list& __list);
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558 forward_list&
00559 operator=(forward_list&& __list)
00560 {
00561 if (&__list != this)
00562 {
00563 this->clear();
00564 this->swap(__list);
00565 }
00566 return *this;
00567 }
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577 forward_list&
00578 operator=(std::initializer_list<_Tp> __il)
00579 {
00580 assign(__il);
00581 return *this;
00582 }
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596 template<typename _InputIterator>
00597 void
00598 assign(_InputIterator __first, _InputIterator __last)
00599 {
00600 clear();
00601 insert_after(cbefore_begin(), __first, __last);
00602 }
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614 void
00615 assign(size_type __n, const _Tp& __val)
00616 {
00617 clear();
00618 insert_after(cbefore_begin(), __n, __val);
00619 }
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629 void
00630 assign(std::initializer_list<_Tp> __il)
00631 {
00632 clear();
00633 insert_after(cbefore_begin(), __il);
00634 }
00635
00636
00637 allocator_type
00638 get_allocator() const
00639 { return this->_M_get_Node_allocator(); }
00640
00641
00642
00643
00644
00645
00646
00647 iterator
00648 before_begin()
00649 { return iterator(&this->_M_impl._M_head); }
00650
00651
00652
00653
00654
00655
00656 const_iterator
00657 before_begin() const
00658 { return const_iterator(&this->_M_impl._M_head); }
00659
00660
00661
00662
00663
00664 iterator
00665 begin()
00666 { return iterator(this->_M_impl._M_head._M_next); }
00667
00668
00669
00670
00671
00672
00673 const_iterator
00674 begin() const
00675 { return const_iterator(this->_M_impl._M_head._M_next); }
00676
00677
00678
00679
00680
00681
00682 iterator
00683 end()
00684 { return iterator(0); }
00685
00686
00687
00688
00689
00690
00691 const_iterator
00692 end() const
00693 { return const_iterator(0); }
00694
00695
00696
00697
00698
00699
00700 const_iterator
00701 cbegin() const
00702 { return const_iterator(this->_M_impl._M_head._M_next); }
00703
00704
00705
00706
00707
00708
00709 const_iterator
00710 cbefore_begin() const
00711 { return const_iterator(&this->_M_impl._M_head); }
00712
00713
00714
00715
00716
00717
00718 const_iterator
00719 cend() const
00720 { return const_iterator(0); }
00721
00722
00723
00724
00725
00726 bool
00727 empty() const
00728 { return this->_M_impl._M_head._M_next == 0; }
00729
00730
00731
00732
00733 size_type
00734 max_size() const
00735 { return this->_M_get_Node_allocator().max_size(); }
00736
00737
00738
00739
00740
00741
00742
00743 reference
00744 front()
00745 {
00746 _Node* __front =
00747 __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next);
00748 return __front->_M_value;
00749 }
00750
00751
00752
00753
00754
00755 const_reference
00756 front() const
00757 {
00758 _Node* __front =
00759 __static_pointer_cast<_Node*>(this->_M_impl._M_head._M_next);
00760 return __front->_M_value;
00761 }
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776 template<typename... _Args>
00777 void
00778 emplace_front(_Args&&... __args)
00779 { this->_M_insert_after(cbefore_begin(),
00780 std::forward<_Args>(__args)...); }
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792 void
00793 push_front(const _Tp& __val)
00794 { this->_M_insert_after(cbefore_begin(), __val); }
00795
00796
00797
00798
00799 void
00800 push_front(_Tp&& __val)
00801 { this->_M_insert_after(cbefore_begin(), std::move(__val)); }
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815 void
00816 pop_front()
00817 { this->_M_erase_after(&this->_M_impl._M_head); }
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832 template<typename... _Args>
00833 iterator
00834 emplace_after(const_iterator __pos, _Args&&... __args)
00835 { return iterator(this->_M_insert_after(__pos,
00836 std::forward<_Args>(__args)...)); }
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850 iterator
00851 insert_after(const_iterator __pos, const _Tp& __val)
00852 { return iterator(this->_M_insert_after(__pos, __val)); }
00853
00854
00855
00856
00857 iterator
00858 insert_after(const_iterator __pos, _Tp&& __val)
00859 { return iterator(this->_M_insert_after(__pos, std::move(__val))); }
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874 void
00875 insert_after(const_iterator __pos, size_type __n, const _Tp& __val)
00876 {
00877 forward_list __tmp(__n, __val, this->get_allocator());
00878 this->splice_after(__pos, std::move(__tmp));
00879 }
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894 template<typename _InputIterator>
00895 void
00896 insert_after(const_iterator __pos,
00897 _InputIterator __first, _InputIterator __last)
00898 {
00899 forward_list __tmp(__first, __last, this->get_allocator());
00900 this->splice_after(__pos, std::move(__tmp));
00901 }
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916 void
00917 insert_after(const_iterator __pos, std::initializer_list<_Tp> __il)
00918 {
00919 forward_list __tmp(__il, this->get_allocator());
00920 this->splice_after(__pos, std::move(__tmp));
00921 }
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939 iterator
00940 erase_after(const_iterator __pos)
00941 {
00942 _Node_base* __tmp = __const_pointer_cast<_Node_base*>(__pos._M_node);
00943 if (__tmp)
00944 return iterator(this->_M_erase_after(__tmp));
00945 else
00946 return end();
00947 }
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968 iterator
00969 erase_after(const_iterator __pos, iterator __last)
00970 {
00971 _Node_base* __tmp = __const_pointer_cast<_Node_base*>(__pos._M_node);
00972 return iterator(this->_M_erase_after(__tmp, &*__last._M_node));
00973 }
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985 void
00986 swap(forward_list&& __list)
00987 { _Node_base::swap(this->_M_impl._M_head, __list._M_impl._M_head); }
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000 void
01001 resize(size_type __sz)
01002 { resize(__sz, _Tp()); }
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016 void
01017 resize(size_type __sz, value_type __val);
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027 void
01028 clear()
01029 { this->_M_erase_after(&this->_M_impl._M_head, 0); }
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044 void
01045 splice_after(const_iterator __pos, forward_list&& __list);
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057 void
01058 splice_after(const_iterator __pos, forward_list&& __list,
01059 const_iterator __it)
01060 { this->splice_after(__pos, __list, __it, __it._M_next()); }
01061
01062
01063
01064
01065
01066
01067
01068
01069
01070
01071
01072
01073
01074
01075 void
01076 splice_after(const_iterator __pos, forward_list&& __list,
01077 const_iterator __before, const_iterator __last);
01078
01079
01080
01081
01082
01083
01084
01085
01086
01087
01088
01089
01090 void
01091 remove(const _Tp& __val);
01092
01093
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103
01104 template<typename _Pred>
01105 void
01106 remove_if(_Pred __pred);
01107
01108
01109
01110
01111
01112
01113
01114
01115
01116
01117
01118 void
01119 unique()
01120 { this->unique(std::equal_to<_Tp>()); }
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134 template<typename _BinPred>
01135 void
01136 unique(_BinPred __binary_pred);
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147 void
01148 merge(forward_list&& __list)
01149 { this->merge(__list, std::less<_Tp>()); }
01150
01151
01152
01153
01154
01155
01156
01157
01158
01159
01160
01161
01162 template<typename _Comp>
01163 void
01164 merge(forward_list&& __list, _Comp __comp);
01165
01166
01167
01168
01169
01170
01171
01172 void
01173 sort()
01174 {
01175 _Node* __tmp = __static_pointer_cast<_Node*>(&this->_M_impl._M_head);
01176 __tmp->_M_sort_after(std::less<_Tp>());
01177 }
01178
01179
01180
01181
01182
01183
01184
01185 template<typename _Comp>
01186 void
01187 sort(_Comp __comp)
01188 {
01189 _Node* __tmp = __static_pointer_cast<_Node*>(&this->_M_impl._M_head);
01190 __tmp->_M_sort_after(__comp);
01191 }
01192
01193
01194
01195
01196
01197
01198 void
01199 reverse()
01200 { this->_M_impl._M_head._M_reverse_after(); }
01201
01202 private:
01203 template<typename _Integer>
01204 void
01205 _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
01206 { _M_fill_initialize(static_cast<size_type>(__n), __x); }
01207
01208
01209 template<typename _InputIterator>
01210 void
01211 _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
01212 __false_type);
01213
01214
01215
01216 void
01217 _M_fill_initialize(size_type __n, const value_type& __value);
01218 };
01219
01220
01221
01222
01223
01224
01225
01226
01227
01228
01229
01230 template<typename _Tp, typename _Alloc>
01231 bool
01232 operator==(const forward_list<_Tp, _Alloc>& __lx,
01233 const forward_list<_Tp, _Alloc>& __ly);
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246 template<typename _Tp, typename _Alloc>
01247 inline bool
01248 operator<(const forward_list<_Tp, _Alloc>& __lx,
01249 const forward_list<_Tp, _Alloc>& __ly)
01250 { return std::lexicographical_compare(__lx.cbegin(), __lx.cend(),
01251 __ly.cbegin(), __ly.cend()); }
01252
01253
01254 template<typename _Tp, typename _Alloc>
01255 inline bool
01256 operator!=(const forward_list<_Tp, _Alloc>& __lx,
01257 const forward_list<_Tp, _Alloc>& __ly)
01258 { return !(__lx == __ly); }
01259
01260
01261 template<typename _Tp, typename _Alloc>
01262 inline bool
01263 operator>(const forward_list<_Tp, _Alloc>& __lx,
01264 const forward_list<_Tp, _Alloc>& __ly)
01265 { return (__ly < __lx); }
01266
01267
01268 template<typename _Tp, typename _Alloc>
01269 inline bool
01270 operator>=(const forward_list<_Tp, _Alloc>& __lx,
01271 const forward_list<_Tp, _Alloc>& __ly)
01272 { return !(__lx < __ly); }
01273
01274
01275 template<typename _Tp, typename _Alloc>
01276 inline bool
01277 operator<=(const forward_list<_Tp, _Alloc>& __lx,
01278 const forward_list<_Tp, _Alloc>& __ly)
01279 { return !(__ly < __lx); }
01280
01281
01282 template<typename _Tp, typename _Alloc>
01283 inline void
01284 swap(forward_list<_Tp, _Alloc>& __lx,
01285 forward_list<_Tp, _Alloc>& __ly)
01286 { __lx.swap(__ly); }
01287
01288
01289 template<typename _Tp, typename _Alloc>
01290 inline void
01291 swap(forward_list<_Tp, _Alloc>&& __lx,
01292 forward_list<_Tp, _Alloc>& __ly)
01293 { __lx.swap(__ly); }
01294
01295
01296 template<typename _Tp, typename _Alloc>
01297 inline void
01298 swap(forward_list<_Tp, _Alloc>& __lx,
01299 forward_list<_Tp, _Alloc>&& __ly)
01300 { __lx.swap(__ly); }
01301
01302 _GLIBCXX_END_NAMESPACE
01303
01304 #endif // __GXX_EXPERIMENTAL_CXX0X__
01305
01306 #endif // _FORWARD_LIST_H