2001-12-28 19:46:54 +01:00
|
|
|
// Algorithm extensions -*- C++ -*-
|
|
|
|
|
2010-02-04 19:20:34 +01:00
|
|
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
stl_algobase.h: Do not include <cstring>.
2007-05-07 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h: Do not include <cstring>.
(copy(const _Tp*, const _Tp*, _Tp*), __copy_b(const _Tp*, const _Tp*,
_Tp*)): Use __builtin_memmove.
(__fill_aux): Use __builtin_memset.
(equal(const _Tp*, const _Tp*, const _Tp*),
lexicographical_compare(const unsigned char*, const unsigned char*,
const unsigned char*, const unsigned char*)): Use __builtin_memcmp.
* include/bits/valarray_array.h: Do not include <cstring>.
(_Array_default_ctor<, true>::_S_do_it): Use __builtin_memset.
(_Array_copy_ctor<, true>::_S_do_it, _Array_copier<, true>::_S_do_it):
Use __builtin_memcpy.
* include/ext/algorithm
(__lexicographical_compare_3way(const unsigned char*,
const unsigned char*, const unsigned char*, const unsigned char*)):
Use __builtin_memcmp.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
From-SVN: r124511
2007-05-07 22:36:40 +02:00
|
|
|
// Free Software Foundation, Inc.
|
2001-12-28 19:46:54 +01:00
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2001-12-28 19:46:54 +01:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994
|
|
|
|
* Hewlett-Packard Company
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Hewlett-Packard Company makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1996
|
|
|
|
* Silicon Graphics Computer Systems, Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Silicon Graphics makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*/
|
|
|
|
|
Makefile.am (doxygen, [...]): Tweak targets.
2002-01-28 Phil Edwards <pme@gcc.gnu.org>
* Makefile.am (doxygen, doxygen-maint, doxygen-man): Tweak targets.
* Makefile.in: Regenerate.
* docs/doxygen/run_doxygen: Update, mostly for man pages.
* docs/doxygen/Intro.3: Update.
* docs/doxygen/TODO: Update.
* docs/doxygen/doxygroups.cc: Add namespace hook for __gnu_cxx.
* docs/doxygen/mainpage.doxy: Update.
* docs/doxygen/user.cfg.in: Update for header rename. Also
regenerate comments and variables with 1.2.12.
* docs/doxygen/maint.cfg.in: Remove file.
* include/bits/stl_relops.h: Doxygenate.
* include/bits/stl_tempbuf.h (std::_Temporary_buffer): Likewise.
* include/c_std/std_cassert.h, include/c_std/std_cctype.h,
include/c_std/std_cerrno.h, include/c_std/std_cfloat.h,
include/c_std/std_ciso646.h, include/c_std/std_climits.h,
include/c_std/std_clocale.h, include/c_std/std_cmath.h,
include/c_std/std_csetjmp.h, include/c_std/std_csignal.h,
include/c_std/std_cstdarg.h, include/c_std/std_cstddef.h,
include/c_std/std_cstdio.h, include/c_std/std_cstdlib.h,
include/c_std/std_cstring.h, include/c_std/std_ctime.h,
include/c_std/std_cwchar.h, include/c_std/std_cwctype.h,
include/ext/algorithm, include/ext/functional, include/ext/hash_map,
include/ext/hash_set, include/ext/iterator, include/ext/memory,
include/ext/numeric, include/ext/rb_tree, include/ext/rope,
include/ext/ropeimpl.h, include/ext/slist, include/ext/stl_hash_fun.h,
include/ext/stl_hashtable.h, include/ext/stl_rope.h,
include/std/std_algorithm.h, include/std/std_bitset.h,
include/std/std_complex.h, include/std/std_deque.h,
include/std/std_fstream.h, include/std/std_functional.h,
include/std/std_iomanip.h, include/std/std_ios.h,
include/std/std_iosfwd.h, include/std/std_iostream.h,
include/std/std_istream.h, include/std/std_iterator.h,
include/std/std_limits.h, include/std/std_list.h,
include/std/std_locale.h, include/std/std_map.h,
include/std/std_memory.h, include/std/std_numeric.h,
include/std/std_ostream.h, include/std/std_queue.h,
include/std/std_set.h, include/std/std_sstream.h,
include/std/std_stack.h, include/std/std_stdexcept.h,
include/std/std_streambuf.h, include/std/std_string.h,
include/std/std_utility.h, include/std/std_valarray.h,
include/std/std_vector.h: Add/correct @file doxygen hook.
* include/ext/memory: Doxygenate most of rest of file.
* libsupc++/exception: Doxygen output formatting.
* libsupc++/new: Say which header it is.
* testsuite/lib/libstdc++-v3-dg.exp: Fix spacing.
* docs/html/19_diagnostics/howto.html: Describe concept-checks switch.
* docs/html/23_containers/howto.html: Describe O(n) list::size().
* docs/html/27_io/howto.html: Also link to Langer and Kreft text.
From-SVN: r49300
2002-01-28 23:13:12 +01:00
|
|
|
/** @file ext/algorithm
|
|
|
|
* This file is a GNU extension to the Standard C++ Library (possibly
|
2004-11-24 05:11:23 +01:00
|
|
|
* containing extensions from the HP/SGI STL subset).
|
Makefile.am (doxygen, [...]): Tweak targets.
2002-01-28 Phil Edwards <pme@gcc.gnu.org>
* Makefile.am (doxygen, doxygen-maint, doxygen-man): Tweak targets.
* Makefile.in: Regenerate.
* docs/doxygen/run_doxygen: Update, mostly for man pages.
* docs/doxygen/Intro.3: Update.
* docs/doxygen/TODO: Update.
* docs/doxygen/doxygroups.cc: Add namespace hook for __gnu_cxx.
* docs/doxygen/mainpage.doxy: Update.
* docs/doxygen/user.cfg.in: Update for header rename. Also
regenerate comments and variables with 1.2.12.
* docs/doxygen/maint.cfg.in: Remove file.
* include/bits/stl_relops.h: Doxygenate.
* include/bits/stl_tempbuf.h (std::_Temporary_buffer): Likewise.
* include/c_std/std_cassert.h, include/c_std/std_cctype.h,
include/c_std/std_cerrno.h, include/c_std/std_cfloat.h,
include/c_std/std_ciso646.h, include/c_std/std_climits.h,
include/c_std/std_clocale.h, include/c_std/std_cmath.h,
include/c_std/std_csetjmp.h, include/c_std/std_csignal.h,
include/c_std/std_cstdarg.h, include/c_std/std_cstddef.h,
include/c_std/std_cstdio.h, include/c_std/std_cstdlib.h,
include/c_std/std_cstring.h, include/c_std/std_ctime.h,
include/c_std/std_cwchar.h, include/c_std/std_cwctype.h,
include/ext/algorithm, include/ext/functional, include/ext/hash_map,
include/ext/hash_set, include/ext/iterator, include/ext/memory,
include/ext/numeric, include/ext/rb_tree, include/ext/rope,
include/ext/ropeimpl.h, include/ext/slist, include/ext/stl_hash_fun.h,
include/ext/stl_hashtable.h, include/ext/stl_rope.h,
include/std/std_algorithm.h, include/std/std_bitset.h,
include/std/std_complex.h, include/std/std_deque.h,
include/std/std_fstream.h, include/std/std_functional.h,
include/std/std_iomanip.h, include/std/std_ios.h,
include/std/std_iosfwd.h, include/std/std_iostream.h,
include/std/std_istream.h, include/std/std_iterator.h,
include/std/std_limits.h, include/std/std_list.h,
include/std/std_locale.h, include/std/std_map.h,
include/std/std_memory.h, include/std/std_numeric.h,
include/std/std_ostream.h, include/std/std_queue.h,
include/std/std_set.h, include/std/std_sstream.h,
include/std/std_stack.h, include/std/std_stdexcept.h,
include/std/std_streambuf.h, include/std/std_string.h,
include/std/std_utility.h, include/std/std_valarray.h,
include/std/std_vector.h: Add/correct @file doxygen hook.
* include/ext/memory: Doxygenate most of rest of file.
* libsupc++/exception: Doxygen output formatting.
* libsupc++/new: Say which header it is.
* testsuite/lib/libstdc++-v3-dg.exp: Fix spacing.
* docs/html/19_diagnostics/howto.html: Describe concept-checks switch.
* docs/html/23_containers/howto.html: Describe O(n) list::size().
* docs/html/27_io/howto.html: Also link to Langer and Kreft text.
From-SVN: r49300
2002-01-28 23:13:12 +01:00
|
|
|
*/
|
|
|
|
|
2001-12-28 19:46:54 +01:00
|
|
|
#ifndef _EXT_ALGORITHM
|
2003-07-05 06:05:45 +02:00
|
|
|
#define _EXT_ALGORITHM 1
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2001-12-31 19:03:47 +01:00
|
|
|
#pragma GCC system_header
|
2003-07-05 06:05:45 +02:00
|
|
|
|
Makefile.am (std_headers): Remove cXXX from list.
2002-01-04 Benjamin Kosnik <bkoz@redhat.com>
* include/Makefile.am (std_headers): Remove cXXX from list.
(c_base_srcdir): No bits subdirectory.
(c_base_builddir): Same.
(c_base_headers): Adjust names, add ciso646.
(bits_headers): Remove std_xxx.h headers.
* include/Makefile.in: Regenerate.
* include/ext/iterator: Adjust includes.
* include/ext/ropeimpl.h: Same.
* include/ext/stl_hash_fun.h: Same.
* include/ext/algorithm: Same.
* include/backward/bvector.h: Adjust includes.
* include/backward/vector.h: Same.
* include/backward/strstream: Same.
* include/backward/streambuf.h: Same.
* include/backward/stack.h: Same.
* include/backward/set.h: Same.
* include/backward/queue.h: Same.
* include/backward/multiset.h: Same.
* include/backward/multimap.h: Same.
* include/backward/map.h: Same.
* include/backward/list.h: Same.
* include/backward/iterator.h: Same.
* include/backward/iostream.h: Same.
* include/backward/iomanip.h: Same.
* include/backward/fstream.h: Same.
* include/backward/deque.h: Same.
* include/backward/complex.h: Same.
* include/bits/std_algorithm.h: Move to...
* include/std/algorithm: ...here.
* include/bits/std_iosfwd.h, std_locale.h, std_stack.h,
std_bitset.h, std_ios.h, std_map.h, std_stdexcept.h,
std_complex.h, std_iostream.h, std_memory.h, std_streambuf.h,
std_deque.h, std_istream.h, std_numeric.h, std_string.h,
std_fstream.h, std_ostream.h, std_utility.h, std_iterator.h,
std_queue.h, std_valarray.h, std_functional.h, std_limits.h,
std_set.h, std_vector.h, std_iomanip.h, std_list.h, std_sstream.h:
Same.
* include/c_std/bits/std_cassert.h: Move to...
* include/c_std/cassert: Here.
* include/c_std/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c_std/cmath: Adjust cmath.tcc include.
* include/c_std/cstdlib: Adjust includes.
* include/c_std/cwchar: Same.
* include/c_std/ctime: Same.
* include/c_std/cstring: Same.
* include/c_std/cstdio: Same.
* include/c_std/bits: Remove directory.
* include/c/bits/std_cassert.h: Move to...
* include/c/cassert: Here.
* include/c/std_cctype.h, std_cerrno.h, std_cfloat.h,
std_climits.h, std_clocale.h, std_cmath.h, std_csetjmp.h,
std_csignal.h, std_cstdarg.h, std_cstddef.h, std_cstdio.h,
std_cstdlib.h, std_cstring.h, std_ctime.h, std_cwchar.h,
std_cwctype.h: Same.
* include/c/bits: Remove directory.
* include/std/cwctype: Remove.
* include/std/cwchar: Remove.
* include/std/ctime: Remove.
* include/std/cstring: Remove.
* include/std/cstdlib: Remove.
* include/std/cstdio: Remove.
* include/std/cstddef: Remove.
* include/std/cstdarg: Remove.
* include/std/csignal: Remove.
* include/std/csetjmp: Remove.
* include/std/cmath: Remove.
* include/std/clocale: Remove.
* include/std/climits: Remove.
* include/std/ciso646: Remove.
* include/std/cfloat: Remove.
* include/std/cerrno: Remove.
* include/std/cctype: Remove.
* include/std/cassert: Remove.
* include/bits/fpos.h: Adjust includes, removing <bits/std_xxx.h>
files and subsituting <.xxx>
* include/bits/valarray_array.h: Same.
* include/bits/stl_uninitialized.h: Same.
* include/bits/stl_alloc.h: Same.
* include/bits/stl_algobase.h: Same.
* include/bits/sstream.tcc: Same.
* include/bits/pthread_allocimpl.h: Same.
* include/bits/ostream.tcc: Same.
* include/bits/localefwd.h: Same.
* include/bits/locale_facets.tcc: Same.
* include/bits/locale_facets.h: Same.
* include/bits/istream.tcc: Same.
* include/bits/char_traits.h: Same.
* include/bits/boost_concept_check.h: Same.
* include/bits/basic_file.h: Same.
* include/std/bitset: Same.
* include/std/complex: Same.
* include/std/fstream: Same.
* include/std/functional: Same.
* include/std/ios: Same.
* include/std/iostream: Same.
* include/std/ostream: Same.
* include/std/sstream: Same.
* include/std/streambuf: Same.
* include/std/string: Same.
* include/std/iterator: Same.
* include/std/valarray: Same.
* src/ios.cc: Adjust includes.
* src/valarray-inst.cc: Same.
* src/string-inst.cc: Same.
* src/stl-inst.cc: Same.
* src/stdexcept.cc: Same.
* src/misc-inst.cc: Same.
* src/localename.cc: Same.
* src/locale-inst.cc: Same.
* src/locale.cc: Same.
* src/limits.cc: Same.
* src/concept-inst.cc: Same.
* src/complex_io.cc: Same.
* src/codecvt.cc: Same.
* src/bitset.cc: Same.
* src/cmath.cc: Same.
From-SVN: r48544
2002-01-04 22:27:36 +01:00
|
|
|
#include <algorithm>
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|
|
|
|
2002-01-02 13:16:56 +01:00
|
|
|
using std::ptrdiff_t;
|
|
|
|
using std::min;
|
|
|
|
using std::pair;
|
|
|
|
using std::input_iterator_tag;
|
|
|
|
using std::random_access_iterator_tag;
|
|
|
|
using std::iterator_traits;
|
|
|
|
|
|
|
|
//--------------------------------------------------
|
|
|
|
// copy_n (not part of the C++ standard)
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator, typename _Size, typename _OutputIterator>
|
|
|
|
pair<_InputIterator, _OutputIterator>
|
|
|
|
__copy_n(_InputIterator __first, _Size __count,
|
|
|
|
_OutputIterator __result,
|
2002-01-02 13:16:56 +01:00
|
|
|
input_iterator_tag)
|
|
|
|
{
|
2004-06-12 10:10:24 +02:00
|
|
|
for ( ; __count > 0; --__count)
|
|
|
|
{
|
|
|
|
*__result = *__first;
|
|
|
|
++__first;
|
|
|
|
++__result;
|
|
|
|
}
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
return pair<_InputIterator, _OutputIterator>(__first, __result);
|
2002-01-02 13:16:56 +01:00
|
|
|
}
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _RAIterator, typename _Size, typename _OutputIterator>
|
|
|
|
inline pair<_RAIterator, _OutputIterator>
|
|
|
|
__copy_n(_RAIterator __first, _Size __count,
|
|
|
|
_OutputIterator __result,
|
2002-01-02 13:16:56 +01:00
|
|
|
random_access_iterator_tag)
|
|
|
|
{
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_RAIterator __last = __first + __count;
|
2004-06-12 10:10:24 +02:00
|
|
|
return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first,
|
|
|
|
__last,
|
|
|
|
__result));
|
2002-01-02 13:16:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Copies the range [first,first+count) into [result,result+count).
|
|
|
|
* @param first An input iterator.
|
|
|
|
* @param count The number of elements to copy.
|
|
|
|
* @param result An output iterator.
|
|
|
|
* @return A std::pair composed of first+count and result+count.
|
|
|
|
*
|
|
|
|
* This is an SGI extension.
|
|
|
|
* This inline function will boil down to a call to @c memmove whenever
|
|
|
|
* possible. Failing that, if random access iterators are passed, then the
|
|
|
|
* loop count will be known (and therefore a candidate for compiler
|
|
|
|
* optimizations such as unrolling).
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator, typename _Size, typename _OutputIterator>
|
|
|
|
inline pair<_InputIterator, _OutputIterator>
|
|
|
|
copy_n(_InputIterator __first, _Size __count, _OutputIterator __result)
|
2002-01-02 13:16:56 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
|
|
|
|
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_InputIterator>::value_type>)
|
2002-01-02 13:16:56 +01:00
|
|
|
|
2010-06-29 12:03:36 +02:00
|
|
|
return __gnu_cxx::__copy_n(__first, __count, __result,
|
|
|
|
std::__iterator_category(__first));
|
2002-01-02 13:16:56 +01:00
|
|
|
}
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator1, typename _InputIterator2>
|
2002-01-02 13:16:56 +01:00
|
|
|
int
|
2004-06-12 10:10:24 +02:00
|
|
|
__lexicographical_compare_3way(_InputIterator1 __first1,
|
|
|
|
_InputIterator1 __last1,
|
|
|
|
_InputIterator2 __first2,
|
|
|
|
_InputIterator2 __last2)
|
2002-01-02 13:16:56 +01:00
|
|
|
{
|
2004-06-12 10:10:24 +02:00
|
|
|
while (__first1 != __last1 && __first2 != __last2)
|
|
|
|
{
|
|
|
|
if (*__first1 < *__first2)
|
|
|
|
return -1;
|
|
|
|
if (*__first2 < *__first1)
|
|
|
|
return 1;
|
|
|
|
++__first1;
|
|
|
|
++__first2;
|
|
|
|
}
|
|
|
|
if (__first2 == __last2)
|
2002-01-02 13:16:56 +01:00
|
|
|
return !(__first1 == __last1);
|
2004-06-12 10:10:24 +02:00
|
|
|
else
|
2002-01-02 13:16:56 +01:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int
|
|
|
|
__lexicographical_compare_3way(const unsigned char* __first1,
|
|
|
|
const unsigned char* __last1,
|
|
|
|
const unsigned char* __first2,
|
|
|
|
const unsigned char* __last2)
|
|
|
|
{
|
|
|
|
const ptrdiff_t __len1 = __last1 - __first1;
|
|
|
|
const ptrdiff_t __len2 = __last2 - __first2;
|
stl_algobase.h: Do not include <cstring>.
2007-05-07 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_algobase.h: Do not include <cstring>.
(copy(const _Tp*, const _Tp*, _Tp*), __copy_b(const _Tp*, const _Tp*,
_Tp*)): Use __builtin_memmove.
(__fill_aux): Use __builtin_memset.
(equal(const _Tp*, const _Tp*, const _Tp*),
lexicographical_compare(const unsigned char*, const unsigned char*,
const unsigned char*, const unsigned char*)): Use __builtin_memcmp.
* include/bits/valarray_array.h: Do not include <cstring>.
(_Array_default_ctor<, true>::_S_do_it): Use __builtin_memset.
(_Array_copy_ctor<, true>::_S_do_it, _Array_copier<, true>::_S_do_it):
Use __builtin_memcpy.
* include/ext/algorithm
(__lexicographical_compare_3way(const unsigned char*,
const unsigned char*, const unsigned char*, const unsigned char*)):
Use __builtin_memcmp.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Adjust dg-error line number.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
From-SVN: r124511
2007-05-07 22:36:40 +02:00
|
|
|
const int __result = __builtin_memcmp(__first1, __first2,
|
|
|
|
min(__len1, __len2));
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
return __result != 0 ? __result
|
2002-01-02 13:16:56 +01:00
|
|
|
: (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
|
|
|
|
}
|
|
|
|
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
inline int
|
2002-01-02 13:16:56 +01:00
|
|
|
__lexicographical_compare_3way(const char* __first1, const char* __last1,
|
|
|
|
const char* __first2, const char* __last2)
|
|
|
|
{
|
|
|
|
#if CHAR_MAX == SCHAR_MAX
|
2004-06-12 10:10:24 +02:00
|
|
|
return __lexicographical_compare_3way((const signed char*) __first1,
|
|
|
|
(const signed char*) __last1,
|
|
|
|
(const signed char*) __first2,
|
|
|
|
(const signed char*) __last2);
|
2002-01-02 13:16:56 +01:00
|
|
|
#else
|
|
|
|
return __lexicographical_compare_3way((const unsigned char*) __first1,
|
|
|
|
(const unsigned char*) __last1,
|
|
|
|
(const unsigned char*) __first2,
|
|
|
|
(const unsigned char*) __last2);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief @c memcmp on steroids.
|
|
|
|
* @param first1 An input iterator.
|
|
|
|
* @param last1 An input iterator.
|
|
|
|
* @param first2 An input iterator.
|
|
|
|
* @param last2 An input iterator.
|
|
|
|
* @return An int, as with @c memcmp.
|
|
|
|
*
|
|
|
|
* The return value will be less than zero if the first range is
|
2010-02-04 19:20:34 +01:00
|
|
|
* <em>lexigraphically less than</em> the second, greater than zero
|
|
|
|
* if the second range is <em>lexigraphically less than</em> the
|
|
|
|
* first, and zero otherwise.
|
2002-01-02 13:16:56 +01:00
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator1, typename _InputIterator2>
|
2002-01-02 13:16:56 +01:00
|
|
|
int
|
2004-06-12 10:10:24 +02:00
|
|
|
lexicographical_compare_3way(_InputIterator1 __first1,
|
|
|
|
_InputIterator1 __last1,
|
|
|
|
_InputIterator2 __first2,
|
|
|
|
_InputIterator2 __last2)
|
2002-01-02 13:16:56 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)
|
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)
|
|
|
|
__glibcxx_function_requires(_LessThanComparableConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_InputIterator1>::value_type>)
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_LessThanComparableConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_InputIterator2>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first1, __last1);
|
|
|
|
__glibcxx_requires_valid_range(__first2, __last2);
|
2002-01-02 13:16:56 +01:00
|
|
|
|
2004-06-12 10:10:24 +02:00
|
|
|
return __lexicographical_compare_3way(__first1, __last1, __first2,
|
|
|
|
__last2);
|
2002-01-02 13:16:56 +01:00
|
|
|
}
|
|
|
|
|
2001-12-28 19:46:54 +01:00
|
|
|
// count and count_if: this version, whose return type is void, was present
|
|
|
|
// in the HP STL, and is retained as an extension for backward compatibility.
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator, typename _Tp, typename _Size>
|
2001-12-28 19:46:54 +01:00
|
|
|
void
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
count(_InputIterator __first, _InputIterator __last,
|
2001-12-28 19:46:54 +01:00
|
|
|
const _Tp& __value,
|
|
|
|
_Size& __n)
|
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
|
|
|
|
__glibcxx_function_requires(_EqualityComparableConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_InputIterator>::value_type >)
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_EqualityComparableConcept<_Tp>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
|
|
|
|
2001-12-28 19:46:54 +01:00
|
|
|
for ( ; __first != __last; ++__first)
|
|
|
|
if (*__first == __value)
|
|
|
|
++__n;
|
|
|
|
}
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator, typename _Predicate, typename _Size>
|
2001-12-28 19:46:54 +01:00
|
|
|
void
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
count_if(_InputIterator __first, _InputIterator __last,
|
2001-12-28 19:46:54 +01:00
|
|
|
_Predicate __pred,
|
|
|
|
_Size& __n)
|
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
|
|
|
|
__glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_InputIterator>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
|
|
|
|
2001-12-28 19:46:54 +01:00
|
|
|
for ( ; __first != __last; ++__first)
|
|
|
|
if (__pred(*__first))
|
|
|
|
++__n;
|
|
|
|
}
|
|
|
|
|
|
|
|
// random_sample and random_sample_n (extensions, not part of the standard).
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
2004-06-12 10:10:24 +02:00
|
|
|
template<typename _ForwardIterator, typename _OutputIterator,
|
|
|
|
typename _Distance>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_OutputIterator
|
|
|
|
random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
_OutputIterator __out, const _Distance __n)
|
2001-12-28 19:46:54 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
|
|
|
|
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_ForwardIterator>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
_Distance __remaining = std::distance(__first, __last);
|
2002-01-02 13:16:56 +01:00
|
|
|
_Distance __m = min(__n, __remaining);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2004-06-12 10:10:24 +02:00
|
|
|
while (__m > 0)
|
|
|
|
{
|
|
|
|
if ((std::rand() % __remaining) < __m)
|
|
|
|
{
|
2001-12-28 19:46:54 +01:00
|
|
|
*__out = *__first;
|
|
|
|
++__out;
|
|
|
|
--__m;
|
2004-06-12 10:10:24 +02:00
|
|
|
}
|
|
|
|
--__remaining;
|
|
|
|
++__first;
|
2001-12-28 19:46:54 +01:00
|
|
|
}
|
|
|
|
return __out;
|
|
|
|
}
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
2004-06-12 10:10:24 +02:00
|
|
|
template<typename _ForwardIterator, typename _OutputIterator,
|
|
|
|
typename _Distance, typename _RandomNumberGenerator>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_OutputIterator
|
|
|
|
random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
_OutputIterator __out, const _Distance __n,
|
2001-12-28 19:46:54 +01:00
|
|
|
_RandomNumberGenerator& __rand)
|
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
|
|
|
|
__glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_ForwardIterator>::value_type>)
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_UnaryFunctionConcept<
|
2001-12-28 19:46:54 +01:00
|
|
|
_RandomNumberGenerator, _Distance, _Distance>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
_Distance __remaining = std::distance(__first, __last);
|
2002-01-02 13:16:56 +01:00
|
|
|
_Distance __m = min(__n, __remaining);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2004-06-12 10:10:24 +02:00
|
|
|
while (__m > 0)
|
|
|
|
{
|
|
|
|
if (__rand(__remaining) < __m)
|
|
|
|
{
|
2001-12-28 19:46:54 +01:00
|
|
|
*__out = *__first;
|
|
|
|
++__out;
|
|
|
|
--__m;
|
2004-06-12 10:10:24 +02:00
|
|
|
}
|
|
|
|
--__remaining;
|
|
|
|
++__first;
|
2001-12-28 19:46:54 +01:00
|
|
|
}
|
|
|
|
return __out;
|
|
|
|
}
|
|
|
|
|
2004-06-12 10:10:24 +02:00
|
|
|
template<typename _InputIterator, typename _RandomAccessIterator,
|
|
|
|
typename _Distance>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_RandomAccessIterator
|
|
|
|
__random_sample(_InputIterator __first, _InputIterator __last,
|
|
|
|
_RandomAccessIterator __out,
|
2001-12-28 19:46:54 +01:00
|
|
|
const _Distance __n)
|
|
|
|
{
|
|
|
|
_Distance __m = 0;
|
|
|
|
_Distance __t = __n;
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
for ( ; __first != __last && __m < __n; ++__m, ++__first)
|
2001-12-28 19:46:54 +01:00
|
|
|
__out[__m] = *__first;
|
|
|
|
|
2004-06-12 10:10:24 +02:00
|
|
|
while (__first != __last)
|
|
|
|
{
|
|
|
|
++__t;
|
|
|
|
_Distance __M = std::rand() % (__t);
|
|
|
|
if (__M < __n)
|
|
|
|
__out[__M] = *__first;
|
|
|
|
++__first;
|
|
|
|
}
|
2001-12-28 19:46:54 +01:00
|
|
|
return __out + __m;
|
|
|
|
}
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator, typename _RandomAccessIterator,
|
2001-12-28 19:46:54 +01:00
|
|
|
typename _RandomNumberGenerator, typename _Distance>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_RandomAccessIterator
|
|
|
|
__random_sample(_InputIterator __first, _InputIterator __last,
|
|
|
|
_RandomAccessIterator __out,
|
2001-12-28 19:46:54 +01:00
|
|
|
_RandomNumberGenerator& __rand,
|
|
|
|
const _Distance __n)
|
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_UnaryFunctionConcept<
|
2001-12-28 19:46:54 +01:00
|
|
|
_RandomNumberGenerator, _Distance, _Distance>)
|
|
|
|
|
|
|
|
_Distance __m = 0;
|
|
|
|
_Distance __t = __n;
|
|
|
|
for ( ; __first != __last && __m < __n; ++__m, ++__first)
|
|
|
|
__out[__m] = *__first;
|
|
|
|
|
2004-06-12 10:10:24 +02:00
|
|
|
while (__first != __last)
|
|
|
|
{
|
|
|
|
++__t;
|
|
|
|
_Distance __M = __rand(__t);
|
|
|
|
if (__M < __n)
|
|
|
|
__out[__M] = *__first;
|
|
|
|
++__first;
|
|
|
|
}
|
2001-12-28 19:46:54 +01:00
|
|
|
return __out + __m;
|
|
|
|
}
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _InputIterator, typename _RandomAccessIterator>
|
|
|
|
inline _RandomAccessIterator
|
|
|
|
random_sample(_InputIterator __first, _InputIterator __last,
|
2004-06-12 10:10:24 +02:00
|
|
|
_RandomAccessIterator __out_first,
|
|
|
|
_RandomAccessIterator __out_last)
|
2001-12-28 19:46:54 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
|
|
|
|
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_RandomAccessIterator>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
|
|
|
__glibcxx_requires_valid_range(__out_first, __out_last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
return __random_sample(__first, __last,
|
|
|
|
__out_first, __out_last - __out_first);
|
|
|
|
}
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
template<typename _InputIterator, typename _RandomAccessIterator,
|
2001-12-28 19:46:54 +01:00
|
|
|
typename _RandomNumberGenerator>
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
inline _RandomAccessIterator
|
|
|
|
random_sample(_InputIterator __first, _InputIterator __last,
|
2004-06-12 10:10:24 +02:00
|
|
|
_RandomAccessIterator __out_first,
|
|
|
|
_RandomAccessIterator __out_last,
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
_RandomNumberGenerator& __rand)
|
2001-12-28 19:46:54 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
|
|
|
|
__glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_RandomAccessIterator>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
|
|
|
__glibcxx_requires_valid_range(__out_first, __out_last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
return __random_sample(__first, __last,
|
|
|
|
__out_first, __rand,
|
|
|
|
__out_last - __out_first);
|
|
|
|
}
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _RandomAccessIterator>
|
2001-12-28 19:46:54 +01:00
|
|
|
inline bool
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
2001-12-28 19:46:54 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2004-06-12 10:10:24 +02:00
|
|
|
__glibcxx_function_requires(_RandomAccessIteratorConcept<
|
|
|
|
_RandomAccessIterator>)
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_LessThanComparableConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_RandomAccessIterator>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
return std::__is_heap(__first, __last - __first);
|
2001-12-28 19:46:54 +01:00
|
|
|
}
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _RandomAccessIterator, typename _StrictWeakOrdering>
|
2001-12-28 19:46:54 +01:00
|
|
|
inline bool
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
2001-12-28 19:46:54 +01:00
|
|
|
_StrictWeakOrdering __comp)
|
|
|
|
{
|
|
|
|
// concept requirements
|
2004-06-12 10:10:24 +02:00
|
|
|
__glibcxx_function_requires(_RandomAccessIteratorConcept<
|
|
|
|
_RandomAccessIterator>)
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
typename iterator_traits<_RandomAccessIterator>::value_type,
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_RandomAccessIterator>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
return std::__is_heap(__first, __comp, __last - __first);
|
2001-12-28 19:46:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// is_sorted, a predicated testing whether a range is sorted in
|
|
|
|
// nondescending order. This is an extension, not part of the C++
|
|
|
|
// standard.
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _ForwardIterator>
|
2001-12-28 19:46:54 +01:00
|
|
|
bool
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
is_sorted(_ForwardIterator __first, _ForwardIterator __last)
|
2001-12-28 19:46:54 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
|
|
|
|
__glibcxx_function_requires(_LessThanComparableConcept<
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_ForwardIterator>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
if (__first == __last)
|
|
|
|
return true;
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_ForwardIterator __next = __first;
|
2004-06-12 10:10:24 +02:00
|
|
|
for (++__next; __next != __last; __first = __next, ++__next)
|
2001-12-28 19:46:54 +01:00
|
|
|
if (*__next < *__first)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2002-07-02 08:17:36 +02:00
|
|
|
/**
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
* @doctodo
|
|
|
|
*/
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
template<typename _ForwardIterator, typename _StrictWeakOrdering>
|
2001-12-28 19:46:54 +01:00
|
|
|
bool
|
2004-06-12 10:10:24 +02:00
|
|
|
is_sorted(_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
_StrictWeakOrdering __comp)
|
2001-12-28 19:46:54 +01:00
|
|
|
{
|
|
|
|
// concept requirements
|
2003-07-05 06:05:45 +02:00
|
|
|
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
|
|
|
|
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
|
algorithm, [...]: Remove trailing whitespace.
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
From-SVN: r74464
2003-12-09 05:31:53 +01:00
|
|
|
typename iterator_traits<_ForwardIterator>::value_type,
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
typename iterator_traits<_ForwardIterator>::value_type>)
|
2003-11-11 21:09:16 +01:00
|
|
|
__glibcxx_requires_valid_range(__first, __last);
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
if (__first == __last)
|
|
|
|
return true;
|
|
|
|
|
BUGS: Update from 2.90.8 snapshot.
2003-06-10 Phil Edwards <pme@gcc.gnu.org>
* docs/html/17_intro/BUGS: Update from 2.90.8 snapshot.
* docs/html/17_intro/CHECKLIST: Bring up to date with respect to
correctness of container::iterator typedefs. Fix whitespace.
* docs/html/20_util/howto.html, docs/html/ext/howto.html: Add links
to allocator docs.
* docs/html/documentation.html: Regenerate.
* include/bits/basic_string.h, include/bits/basic_string.tcc,
include/bits/deque.tcc, include/bits/list.tcc, include/bits/stl_algo.h,
include/bits/stl_algobase.h, include/bits/stl_bvector.h,
include/bits/stl_deque.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_list.h, include/bits/stl_uninitialized.h,
include/bits/stl_vector.h, include/bits/vector.tcc,
include/ext/algorithm, include/ext/slist, include/std/std_bitset.h:
Change _Iter names to _Iterator, and __pos to __position.
* include/bits/stl_relops.h, include/bits/stl_numeric.h,
include/bits/stl_multiset.h, include/bits/stl_set.h:
Remove emacs markers.
* include/bits/stl_threads.h (_STL_auto_lock): Add __unused__.
From-SVN: r67736
2003-06-10 23:52:25 +02:00
|
|
|
_ForwardIterator __next = __first;
|
2004-06-12 10:10:24 +02:00
|
|
|
for (++__next; __next != __last; __first = __next, ++__next)
|
2001-12-28 19:46:54 +01:00
|
|
|
if (__comp(*__next, *__first))
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
2005-12-19 01:56:05 +01:00
|
|
|
|
2010-02-15 17:55:20 +01:00
|
|
|
/**
|
|
|
|
* @brief Find the median of three values.
|
|
|
|
* @param a A value.
|
|
|
|
* @param b A value.
|
|
|
|
* @param c A value.
|
|
|
|
* @return One of @p a, @p b or @p c.
|
|
|
|
*
|
|
|
|
* If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n
|
|
|
|
* then the value returned will be @c m.
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
*/
|
|
|
|
template<typename _Tp>
|
|
|
|
const _Tp&
|
|
|
|
__median(const _Tp& __a, const _Tp& __b, const _Tp& __c)
|
|
|
|
{
|
|
|
|
// concept requirements
|
|
|
|
__glibcxx_function_requires(_LessThanComparableConcept<_Tp>)
|
|
|
|
if (__a < __b)
|
|
|
|
if (__b < __c)
|
|
|
|
return __b;
|
|
|
|
else if (__a < __c)
|
|
|
|
return __c;
|
|
|
|
else
|
|
|
|
return __a;
|
|
|
|
else if (__a < __c)
|
|
|
|
return __a;
|
|
|
|
else if (__b < __c)
|
|
|
|
return __c;
|
|
|
|
else
|
|
|
|
return __b;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Find the median of three values using a predicate for comparison.
|
|
|
|
* @param a A value.
|
|
|
|
* @param b A value.
|
|
|
|
* @param c A value.
|
|
|
|
* @param comp A binary predicate.
|
|
|
|
* @return One of @p a, @p b or @p c.
|
|
|
|
*
|
|
|
|
* If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)
|
|
|
|
* and @p comp(m,n) are both true then the value returned will be @c m.
|
|
|
|
* This is an SGI extension.
|
|
|
|
* @ingroup SGIextensions
|
|
|
|
*/
|
|
|
|
template<typename _Tp, typename _Compare>
|
|
|
|
const _Tp&
|
|
|
|
__median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)
|
|
|
|
{
|
|
|
|
// concept requirements
|
|
|
|
__glibcxx_function_requires(_BinaryFunctionConcept<_Compare, bool,
|
|
|
|
_Tp, _Tp>)
|
|
|
|
if (__comp(__a, __b))
|
|
|
|
if (__comp(__b, __c))
|
|
|
|
return __b;
|
|
|
|
else if (__comp(__a, __c))
|
|
|
|
return __c;
|
|
|
|
else
|
|
|
|
return __a;
|
|
|
|
else if (__comp(__a, __c))
|
|
|
|
return __a;
|
|
|
|
else if (__comp(__b, __c))
|
|
|
|
return __c;
|
|
|
|
else
|
|
|
|
return __b;
|
|
|
|
}
|
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_END_NAMESPACE
|
2001-12-28 19:46:54 +01:00
|
|
|
|
|
|
|
#endif /* _EXT_ALGORITHM */
|