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