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