# bits/algorithmfwd.h

Go to the documentation of this file.

    00001 // <algorithm> declarations  -*- C++ -*-
    00002
    00003 // Copyright (C) 2007 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 2, 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 // You should have received a copy of the GNU General Public License along
    00017 // with this library; see the file COPYING.  If not, write to the Free
    00018 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
    00019 // USA.
    00020
    00021 /** @file bits/algorithmfwd.h
    00022  *  This is an internal header file, included by other library headers.
    00023  *  You should not attempt to use it directly.
    00024  */
    00025
    00026 /*
    00027   adjacent_find
    00028   binary_search
    00029   copy
    00030   copy_backward
    00031   count
    00032   count_if
    00033   equal
    00034   equal_range
    00035   fill
    00036   fill_n
    00037   find
    00038   find_end
    00039   find_first_of
    00040   find_if
    00041   for_each
    00042   generate
    00043   generate_n
    00044   includes
    00045   inplace_merge
    00046   is_heap (C++0x)
    00047   is_heap_until (C++0x)
    00048   is_sorted (C++0x)
    00049   is_sorted_until (C++0x)
    00050   iter_swap
    00051   lexicographical_compare
    00052   lower_bound
    00053   make_heap
    00054   max
    00055   max_element
    00056   merge
    00057   min
    00058   min_element
    00059   minmax (C++0x)
    00060   minmax_element (C++0x)
    00061   mismatch
    00062   next_permutation
    00063   nth_element
    00064   partial_sort
    00065   partial_sort_copy
    00066   partition
    00067   pop_heap
    00068   prev_permutation
    00069   push_heap
    00070   random_shuffle
    00071   remove
    00072   remove_copy
    00073   remove_copy_if
    00074   remove_if
    00075   replace
    00076   replace_copy
    00077   replace_copy_if
    00078   replace_if
    00079   reverse
    00080   reverse_copy
    00081   rotate
    00082   rotate_copy
    00083   search
    00084   search_n
    00085   set_difference
    00086   set_intersection
    00087   set_symmetric_difference
    00088   set_union
    00089   sort
    00090   sort_heap
    00091   stable_partition
    00092   stable_sort
    00093   swap
    00094   swap_ranges
    00095   transform
    00096   unique
    00097   unique_copy
    00098   upper_bound
    00099 */
    00100
    00101 #ifndef _GLIBCXX_ALGORITHMFWD_H
    00102 #define _GLIBCXX_ALGORITHMFWD_H 1
    00103
    00104 #pragma GCC system_header
    00105
    00106 #include <bits/c++config.h>
    00107 #include <bits/stl_pair.h>
    00108 #include <bits/stl_iterator_base_types.h>
    00109
    00110 _GLIBCXX_BEGIN_NAMESPACE(std)
    00111
    00112   // adjacent_find
    00113
    00114   template<typename _FIter, typename _Tp>
    00115     bool
    00116     binary_search(_FIter, _FIter, const _Tp&);
    00117
    00118   template<typename _FIter, typename _Tp, typename _Compare>
    00119     bool
    00120     binary_search(_FIter, _FIter, const _Tp&, _Compare);
    00121
    00122   template<typename _IIter, typename _OIter>
    00123     _OIter
    00124     copy(_IIter, _IIter, _OIter);
    00125
    00126   template<typename _BIter1, typename _BIter2>
    00127     _BIter2
    00128     copy_backward(_BIter1, _BIter1, _BIter2);
    00129
    00130   // count
    00131   // count_if
    00132
    00133   template<typename _FIter, typename _Tp>
    00134     pair<_FIter, _FIter>
    00135     equal_range(_FIter, _FIter, const _Tp&);
    00136
    00137   template<typename _FIter, typename _Tp, typename _Compare>
    00138     pair<_FIter, _FIter>
    00139     equal_range(_FIter, _FIter, const _Tp&, _Compare);
    00140
    00141   template<typename _FIter, typename _Tp>
    00142     void
    00143     fill(_FIter, _FIter, const _Tp&);
    00144
    00145 /*
    00146   XXX NB: return type different from ISO C++.
    00147   template<typename _OIter, typename _Size, typename _Tp>
    00148     void
    00149     fill_n(_OIter, _Size, const _Tp&);
    00150 */
    00151
    00152   template<typename _OIter, typename _Size, typename _Tp>
    00153     _OIter
    00154     fill_n(_OIter, _Size, const _Tp&);
    00155
    00156   // find
    00157
    00158   template<typename _FIter1, typename _FIter2>
    00159     _FIter1
    00160     find_end(_FIter1, _FIter1, _FIter2, _FIter2);
    00161
    00162   template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
    00163     _FIter1
    00164     find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
    00165
    00166   // find_first_of
    00167   // find_if
    00168   // for_each
    00169   // generate
    00170   // generate_n
    00171
    00172   template<typename _IIter1, typename _IIter2>
    00173     bool
    00174     includes(_IIter1, _IIter1, _IIter2, _IIter2);
    00175
    00176   template<typename _IIter1, typename _IIter2, typename _Compare>
    00177     bool
    00178     includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
    00179
    00180   template<typename _BIter>
    00181     void
    00182     inplace_merge(_BIter, _BIter, _BIter);
    00183
    00184   template<typename _BIter, typename _Compare>
    00185     void
    00186     inplace_merge(_BIter, _BIter, _BIter, _Compare);
    00187
    00188 #ifdef __GXX_EXPERIMENTAL_CXX0X__
    00189   template<typename _RAIter>
    00190     bool
    00191     is_heap(_RAIter, _RAIter);
    00192
    00193   template<typename _RAIter, typename _Compare>
    00194     bool
    00195     is_heap(_RAIter, _RAIter, _Compare);
    00196
    00197   template<typename _RAIter>
    00198     _RAIter
    00199     is_heap_until(_RAIter, _RAIter);
    00200
    00201   template<typename _RAIter, typename _Compare>
    00202     _RAIter
    00203     is_heap_until(_RAIter, _RAIter, _Compare);
    00204
    00205   template<typename _FIter>
    00206     bool
    00207     is_sorted(_FIter, _FIter);
    00208
    00209   template<typename _FIter, typename _Compare>
    00210     bool
    00211     is_sorted(_FIter, _FIter, _Compare);
    00212
    00213   template<typename _FIter>
    00214     _FIter
    00215     is_sorted_until(_FIter, _FIter);
    00216
    00217   template<typename _FIter, typename _Compare>
    00218     _FIter
    00219     is_sorted_until(_FIter, _FIter, _Compare);
    00220 #endif
    00221
    00222   template<typename _FIter1, typename _FIter2>
    00223     void
    00224     iter_swap(_FIter1, _FIter2);
    00225
    00226   template<typename _FIter, typename _Tp>
    00227     _FIter
    00228     lower_bound(_FIter, _FIter, const _Tp&);
    00229
    00230   template<typename _FIter, typename _Tp, typename _Compare>
    00231     _FIter
    00232     lower_bound(_FIter, _FIter, const _Tp&, _Compare);
    00233
    00234   template<typename _RAIter>
    00235     void
    00236     make_heap(_RAIter, _RAIter);
    00237
    00238   template<typename _RAIter, typename _Compare>
    00239     void
    00240     make_heap(_RAIter, _RAIter, _Compare);
    00241
    00242   template<typename _Tp>
    00243     const _Tp&
    00244     max(const _Tp&, const _Tp&);
    00245
    00246   template<typename _Tp, typename _Compare>
    00247     const _Tp&
    00248     max(const _Tp&, const _Tp&, _Compare);
    00249
    00250   // max_element
    00251   // merge
    00252
    00253   template<typename _Tp>
    00254     const _Tp&
    00255     min(const _Tp&, const _Tp&);
    00256
    00257   template<typename _Tp, typename _Compare>
    00258     const _Tp&
    00259     min(const _Tp&, const _Tp&, _Compare);
    00260
    00261   // min_element
    00262
    00263 #ifdef __GXX_EXPERIMENTAL_CXX0X__
    00264   template<typename _Tp>
    00265     pair<const _Tp&, const _Tp&>
    00266     minmax(const _Tp&, const _Tp&);
    00267
    00268   template<typename _Tp, typename _Compare>
    00269     pair<const _Tp&, const _Tp&>
    00270     minmax(const _Tp&, const _Tp&, _Compare);
    00271
    00272   template<typename _FIter>
    00273     pair<_FIter, _FIter>
    00274     minmax_element(_FIter, _FIter);
    00275
    00276   template<typename _FIter, typename _Compare>
    00277     pair<_FIter, _FIter>
    00278     minmax_element(_FIter, _FIter, _Compare);
    00279 #endif
    00280
    00281   // mismatch
    00282
    00283   template<typename _BIter>
    00284     bool
    00285     next_permutation(_BIter, _BIter);
    00286
    00287   template<typename _BIter, typename _Compare>
    00288     bool
    00289     next_permutation(_BIter, _BIter, _Compare);
    00290
    00291   // nth_element
    00292   // partial_sort
    00293
    00294   template<typename _IIter, typename _RAIter>
    00295     _RAIter
    00296     partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter);
    00297
    00298   template<typename _IIter, typename _RAIter, typename _Compare>
    00299     _RAIter
    00300     partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare);
    00301
    00302   template<typename _RAIter>
    00303     void
    00304     pop_heap(_RAIter, _RAIter);
    00305
    00306   template<typename _RAIter, typename _Compare>
    00307     void
    00308     pop_heap(_RAIter, _RAIter, _Compare);
    00309
    00310   template<typename _BIter>
    00311     bool
    00312     prev_permutation(_BIter, _BIter);
    00313
    00314   template<typename _BIter, typename _Compare>
    00315     bool
    00316     prev_permutation(_BIter, _BIter, _Compare);
    00317
    00318   template<typename _RAIter>
    00319     void
    00320     push_heap(_RAIter, _RAIter);
    00321
    00322   template<typename _RAIter, typename _Compare>
    00323     void
    00324     push_heap(_RAIter, _RAIter, _Compare);
    00325
    00326   // random_shuffle
    00327
    00328   template<typename _FIter, typename _Tp>
    00329     _FIter
    00330     remove(_FIter, _FIter, const _Tp&);
    00331
    00332   template<typename _FIter, typename _Predicate>
    00333     _FIter
    00334     remove_if(_FIter, _FIter, _Predicate);
    00335
    00336   template<typename _IIter, typename _OIter, typename _Tp>
    00337     _OIter
    00338     remove_copy(_IIter, _IIter, _OIter, const _Tp&);
    00339
    00340   template<typename _IIter, typename _OIter, typename _Predicate>
    00341     _OIter
    00342     remove_copy_if(_IIter, _IIter, _OIter, _Predicate);
    00343
    00344   // replace
    00345
    00346   template<typename _IIter, typename _OIter, typename _Tp>
    00347     _OIter
    00348     replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&);
    00349
    00350   template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp>
    00351     _OIter
    00352     replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&);
    00353
    00354   // replace_if
    00355
    00356   template<typename _BIter>
    00357     void
    00358     reverse(_BIter, _BIter);
    00359
    00360   template<typename _BIter, typename _OIter>
    00361     _OIter
    00362     reverse_copy(_BIter, _BIter, _OIter);
    00363
    00364   template<typename _FIter>
    00365     void
    00366     rotate(_FIter, _FIter, _FIter);
    00367
    00368   template<typename _FIter, typename _OIter>
    00369     _OIter
    00370     rotate_copy(_FIter, _FIter, _FIter, _OIter);
    00371
    00372   // search
    00373   // search_n
    00374   // set_difference
    00375   // set_intersection
    00376   // set_symmetric_difference
    00377   // set_union
    00378
    00379   template<typename _RAIter>
    00380     void
    00381     sort_heap(_RAIter, _RAIter);
    00382
    00383   template<typename _RAIter, typename _Compare>
    00384     void
    00385     sort_heap(_RAIter, _RAIter, _Compare);
    00386
    00387   template<typename _BIter, typename _Predicate>
    00388     _BIter
    00389     stable_partition(_BIter, _BIter, _Predicate);
    00390
    00391   template<typename _Tp>
    00392     void
    00393     swap(_Tp&, _Tp&);
    00394
    00395   template<typename _FIter1, typename _FIter2>
    00396     _FIter2
    00397     swap_ranges(_FIter1, _FIter1, _FIter2);
    00398
    00399   // transform
    00400
    00401   template<typename _FIter>
    00402     _FIter
    00403     unique(_FIter, _FIter);
    00404
    00405   template<typename _FIter, typename _BinaryPredicate>
    00406     _FIter
    00407     unique(_FIter, _FIter, _BinaryPredicate);
    00408
    00409   // unique_copy
    00410
    00411   template<typename _FIter, typename _Tp>
    00412     _FIter
    00413     upper_bound(_FIter, _FIter, const _Tp&);
    00414
    00415   template<typename _FIter, typename _Tp, typename _Compare>
    00416     _FIter
    00417     upper_bound(_FIter, _FIter, const _Tp&, _Compare);
    00418
    00419 _GLIBCXX_END_NAMESPACE
    00420
    00421 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
    00422
    00423   template<typename _FIter>
    00424     _FIter
    00425     adjacent_find(_FIter, _FIter);
    00426
    00427   template<typename _FIter, typename _BinaryPredicate>
    00428     _FIter
    00429     adjacent_find(_FIter, _FIter, _BinaryPredicate);
    00430
    00431   template<typename _IIter, typename _Tp>
    00432     typename iterator_traits<_IIter>::difference_type
    00433     count(_IIter, _IIter, const _Tp&);
    00434
    00435   template<typename _IIter, typename _Predicate>
    00436     typename iterator_traits<_IIter>::difference_type
    00437     count_if(_IIter, _IIter, _Predicate);
    00438
    00439   template<typename _IIter1, typename _IIter2>
    00440     bool
    00441     equal(_IIter1, _IIter1, _IIter2);
    00442
    00443   template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
    00444     bool
    00445     equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
    00446
    00447   template<typename _IIter, typename _Tp>
    00448     _IIter
    00449     find(_IIter, _IIter, const _Tp&);
    00450
    00451   template<typename _FIter1, typename _FIter2>
    00452     _FIter1
    00453     find_first_of(_FIter1, _FIter1, _FIter2, _FIter2);
    00454
    00455   template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
    00456     _FIter1
    00457     find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
    00458
    00459   template<typename _IIter, typename _Predicate>
    00460     _IIter
    00461     find_if(_IIter, _IIter, _Predicate);
    00462
    00463   template<typename _IIter, typename _Funct>
    00464     _Funct
    00465     for_each(_IIter, _IIter, _Funct);
    00466
    00467   template<typename _FIter, typename _Generator>
    00468     void
    00469     generate(_FIter, _FIter, _Generator);
    00470
    00471 /*
    00472   XXX NB: return type different from ISO C++.
    00473   template<typename _OIter, typename _Size, typename _Tp>
    00474     void
    00475     generate_n(_OIter, _Size, _Generator);
    00476 */
    00477
    00478   template<typename _OIter, typename _Size, typename _Generator>
    00479     _OIter
    00480     generate_n(_OIter, _Size, _Generator);
    00481
    00482   template<typename _IIter1, typename _IIter2>
    00483     bool
    00484     lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2);
    00485
    00486   template<typename _IIter1, typename _IIter2, typename _Compare>
    00487     bool
    00488     lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare);
    00489
    00490   template<typename _FIter>
    00491     _FIter
    00492     max_element(_FIter, _FIter);
    00493
    00494   template<typename _FIter, typename _Compare>
    00495     _FIter
    00496     max_element(_FIter, _FIter, _Compare);
    00497
    00498   template<typename _IIter1, typename _IIter2, typename _OIter>
    00499     _OIter
    00500     merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
    00501
    00502   template<typename _IIter1, typename _IIter2, typename _OIter,
    00503        typename _Compare>
    00504     _OIter
    00505     merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
    00506
    00507   template<typename _FIter>
    00508     _FIter
    00509     min_element(_FIter, _FIter);
    00510
    00511   template<typename _FIter, typename _Compare>
    00512     _FIter
    00513     min_element(_FIter, _FIter, _Compare);
    00514
    00515   template<typename _IIter1, typename _IIter2>
    00516     pair<_IIter1, _IIter2>
    00517     mismatch(_IIter1, _IIter1, _IIter2);
    00518
    00519   template<typename _IIter1, typename _IIter2, typename _BinaryPredicate>
    00520     pair<_IIter1, _IIter2>
    00521     mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate);
    00522
    00523   template<typename _RAIter>
    00524     void
    00525     nth_element(_RAIter, _RAIter, _RAIter);
    00526
    00527   template<typename _RAIter, typename _Compare>
    00528     void
    00529     nth_element(_RAIter, _RAIter, _RAIter, _Compare);
    00530
    00531   template<typename _RAIter>
    00532     void
    00533     partial_sort(_RAIter, _RAIter, _RAIter);
    00534
    00535   template<typename _RAIter, typename _Compare>
    00536     void
    00537     partial_sort(_RAIter, _RAIter, _RAIter, _Compare);
    00538
    00539   template<typename _BIter, typename _Predicate>
    00540     _BIter
    00541     partition(_BIter, _BIter, _Predicate);
    00542
    00543   template<typename _RAIter>
    00544     void
    00545     random_shuffle(_RAIter, _RAIter);
    00546
    00547   template<typename _RAIter, typename _Generator>
    00548     void
    00549     random_shuffle(_RAIter, _RAIter, _Generator&);
    00550
    00551   template<typename _FIter, typename _Tp>
    00552     void
    00553     replace(_FIter, _FIter, const _Tp&, const _Tp&);
    00554
    00555   template<typename _FIter, typename _Predicate, typename _Tp>
    00556     void
    00557     replace_if(_FIter, _FIter, _Predicate, const _Tp&);
    00558
    00559   template<typename _FIter1, typename _FIter2>
    00560     _FIter1
    00561     search(_FIter1, _FIter1, _FIter2, _FIter2);
    00562
    00563   template<typename _FIter1, typename _FIter2, typename _BinaryPredicate>
    00564     _FIter1
    00565     search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate);
    00566
    00567   template<typename _FIter, typename _Size, typename _Tp>
    00568     _FIter
    00569     search_n(_FIter, _FIter, _Size, const _Tp&);
    00570
    00571   template<typename _FIter, typename _Size, typename _Tp,
    00572        typename _BinaryPredicate>
    00573     _FIter
    00574     search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate);
    00575
    00576   template<typename _IIter1, typename _IIter2, typename _OIter>
    00577     _OIter
    00578     set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
    00579
    00580   template<typename _IIter1, typename _IIter2, typename _OIter,
    00581        typename _Compare>
    00582     _OIter
    00583     set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
    00584
    00585   template<typename _IIter1, typename _IIter2, typename _OIter>
    00586     _OIter
    00587     set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
    00588
    00589   template<typename _IIter1, typename _IIter2, typename _OIter,
    00590        typename _Compare>
    00591     _OIter
    00592     set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
    00593
    00594   template<typename _IIter1, typename _IIter2, typename _OIter>
    00595     _OIter
    00596     set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
    00597
    00598   template<typename _IIter1, typename _IIter2, typename _OIter,
    00599        typename _Compare>
    00600     _OIter
    00601     set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2,
    00602                  _OIter, _Compare);
    00603
    00604   template<typename _IIter1, typename _IIter2, typename _OIter>
    00605     _OIter
    00606     set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter);
    00607
    00608   template<typename _IIter1, typename _IIter2, typename _OIter,
    00609        typename _Compare>
    00610     _OIter
    00611     set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare);
    00612
    00613   template<typename _RAIter>
    00614     void
    00615     sort(_RAIter, _RAIter);
    00616
    00617   template<typename _RAIter, typename _Compare>
    00618     void
    00619     sort(_RAIter, _RAIter, _Compare);
    00620
    00621   template<typename _RAIter>
    00622     void
    00623     stable_sort(_RAIter, _RAIter);
    00624
    00625   template<typename _RAIter, typename _Compare>
    00626     void
    00627     stable_sort(_RAIter, _RAIter, _Compare);
    00628
    00629   template<typename _IIter, typename _OIter, typename _UnaryOperation>
    00630     _OIter
    00631     transform(_IIter, _IIter, _OIter, _UnaryOperation);
    00632
    00633   template<typename _IIter1, typename _IIter2, typename _OIter,
    00634        typename _BinaryOperation>
    00635     _OIter
    00636     transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation);
    00637
    00638   template<typename _IIter, typename _OIter>
    00639     _OIter
    00640     unique_copy(_IIter, _IIter, _OIter);
    00641
    00642   template<typename _IIter, typename _OIter, typename _BinaryPredicate>
    00643     _OIter
    00644     unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate);
    00645
    00646 _GLIBCXX_END_NESTED_NAMESPACE
    00647
    00648 #ifdef _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL
    00649 # include <parallel/algorithmfwd.h>
    00650 #endif
    00651
    00652 #endif
    00653