stl_bvector.h: Change calls to 3-argument distance() into standard 2-argument version.
2001-12-31 Phil Edwards <pme@gcc.gnu.org> * include/bits/stl_bvector.h: Change calls to 3-argument distance() into standard 2-argument version. * include/bits/stl_deque.h: Likewise. * include/bits/stl_tempbuf.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/ext/stl_hashtable.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Move distance() extension... * include/ext/iterator: to here. New file. * include/Makefile.am (ext_headers): Add new file, alphabatize. * include/Makefile.in: Regenerate. From-SVN: r48428
This commit is contained in:
parent
c49b2550b7
commit
3d90ff9352
|
@ -1,3 +1,17 @@
|
|||
2001-12-31 Phil Edwards <pme@gcc.gnu.org>
|
||||
|
||||
* include/bits/stl_bvector.h: Change calls to 3-argument distance()
|
||||
into standard 2-argument version.
|
||||
* include/bits/stl_deque.h: Likewise.
|
||||
* include/bits/stl_tempbuf.h: Likewise.
|
||||
* include/bits/stl_tree.h: Likewise.
|
||||
* include/bits/stl_vector.h: Likewise.
|
||||
* include/ext/stl_hashtable.h: Likewise.
|
||||
* include/bits/stl_iterator_base_funcs.h: Move distance() extension...
|
||||
* include/ext/iterator: to here. New file.
|
||||
* include/Makefile.am (ext_headers): Add new file, alphabatize.
|
||||
* include/Makefile.in: Regenerate.
|
||||
|
||||
2001-12-31 Phil Edwards <pme@gcc.gnu.org>
|
||||
|
||||
* include/bits/stl_deque.h: Doxygenate with initial/example hooks.
|
||||
|
|
|
@ -173,14 +173,15 @@ ext_srcdir = ${glibcpp_srcdir}/include/ext
|
|||
ext_builddir = ./ext
|
||||
ext_headers = \
|
||||
${ext_srcdir}/algorithm \
|
||||
${ext_srcdir}/rope \
|
||||
${ext_srcdir}/ropeimpl.h \
|
||||
${ext_srcdir}/stl_rope.h \
|
||||
${ext_srcdir}/slist \
|
||||
${ext_srcdir}/hash_map \
|
||||
${ext_srcdir}/hash_set \
|
||||
${ext_srcdir}/iterator \
|
||||
${ext_srcdir}/rope \
|
||||
${ext_srcdir}/ropeimpl.h \
|
||||
${ext_srcdir}/slist \
|
||||
${ext_srcdir}/stl_hash_fun.h \
|
||||
${ext_srcdir}/stl_hashtable.h \
|
||||
${ext_srcdir}/stl_hash_fun.h
|
||||
${ext_srcdir}/stl_rope.h
|
||||
|
||||
# This is the common subset of files that all three "C" header models use.
|
||||
c_base_srcdir = @C_INCLUDE_DIR@/bits
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
@ -11,7 +10,6 @@
|
|||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
|
@ -33,9 +31,13 @@ infodir = @infodir@
|
|||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
|
@ -44,11 +46,11 @@ AUTOMAKE = @AUTOMAKE@
|
|||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
|
@ -82,6 +84,7 @@ C_INCLUDE_DIR = @C_INCLUDE_DIR@
|
|||
DATADIRNAME = @DATADIRNAME@
|
||||
DEBUG_FLAGS = @DEBUG_FLAGS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
|
||||
GCJ = @GCJ@
|
||||
GCJFLAGS = @GCJFLAGS@
|
||||
|
@ -105,6 +108,7 @@ LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
|
|||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
|
@ -142,23 +146,16 @@ libtool_VERSION = @libtool_VERSION@
|
|||
release_VERSION = @release_VERSION@
|
||||
toplevel_srcdir = @toplevel_srcdir@
|
||||
|
||||
# Cross compiler and multilib support.
|
||||
CXX = @glibcpp_CXX@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
glibcpp_srcdir = @glibcpp_srcdir@
|
||||
|
||||
# Target includes for threads
|
||||
glibcpp_thread_h = @glibcpp_thread_h@
|
||||
|
||||
# One big happy istallation: just copy everything from the build to the
|
||||
# install tree (except for the build stamps).
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.3 gnits
|
||||
MAINT_CHARSET = latin1
|
||||
|
||||
mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
|
||||
|
||||
# Cross compiler and multilib support.
|
||||
CXX = @glibcpp_CXX@
|
||||
glibcpp_srcdir = @glibcpp_srcdir@
|
||||
glibcpp_builddir = @glibcpp_builddir@
|
||||
|
||||
bits_srcdir = ${glibcpp_srcdir}/include/bits
|
||||
bits_builddir = ./bits
|
||||
bits_headers = \
|
||||
|
@ -303,14 +300,15 @@ ext_srcdir = ${glibcpp_srcdir}/include/ext
|
|||
ext_builddir = ./ext
|
||||
ext_headers = \
|
||||
${ext_srcdir}/algorithm \
|
||||
${ext_srcdir}/rope \
|
||||
${ext_srcdir}/ropeimpl.h \
|
||||
${ext_srcdir}/stl_rope.h \
|
||||
${ext_srcdir}/slist \
|
||||
${ext_srcdir}/hash_map \
|
||||
${ext_srcdir}/hash_set \
|
||||
${ext_srcdir}/iterator \
|
||||
${ext_srcdir}/rope \
|
||||
${ext_srcdir}/ropeimpl.h \
|
||||
${ext_srcdir}/slist \
|
||||
${ext_srcdir}/stl_hash_fun.h \
|
||||
${ext_srcdir}/stl_hashtable.h \
|
||||
${ext_srcdir}/stl_hash_fun.h
|
||||
${ext_srcdir}/stl_rope.h
|
||||
|
||||
|
||||
# This is the common subset of files that all three "C" header models use.
|
||||
|
@ -412,108 +410,116 @@ thread_headers = \
|
|||
allstamps = stamp-std stamp-bits stamp-c_base stamp-backward stamp-ext \
|
||||
stamp-target stamp-thread
|
||||
|
||||
|
||||
# Target includes for threads
|
||||
glibcpp_thread_h = @glibcpp_thread_h@
|
||||
uppercase = [ABCDEFGHIJKLMNOPQRSTUVWXYZ_]
|
||||
subdir = include
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
depcomp =
|
||||
DIST_SOURCES =
|
||||
all: all-am
|
||||
|
||||
# One big happy istallation: just copy everything from the build to the
|
||||
# install tree (except for the build stamps).
|
||||
gxx_include_dir = @gxx_include_dir@
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnits include/Makefile
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --cygnus include/Makefile
|
||||
Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && \
|
||||
CONFIG_HEADERS= CONFIG_LINKS= \
|
||||
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
|
||||
uninstall-info-am:
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
check-am:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = include
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits include/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile all-local
|
||||
|
||||
installdirs:
|
||||
|
||||
install: install-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-data-local
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile all-local
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
distclean-am: clean-am distclean-generic distclean-libtool
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-data-local
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info:
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
uninstall-am:
|
||||
clean: clean-am
|
||||
|
||||
.PHONY: all all-am all-local check check-am clean clean-generic \
|
||||
clean-libtool distclean distclean-generic distclean-libtool dvi \
|
||||
dvi-am info info-am install install-am install-data \
|
||||
install-data-am install-data-local install-exec install-exec-am \
|
||||
install-info install-info-am install-man install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool uninstall uninstall-am uninstall-info-am
|
||||
distclean-am: distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: tags distdir info-am info dvi-am dvi check check-am \
|
||||
installcheck-am installcheck install-exec-am install-exec \
|
||||
install-data-local install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-local all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Here are the rules for building the headers
|
||||
|
@ -620,6 +626,7 @@ install-data-local:
|
|||
|
||||
# By adding these files here, automake will remove them for 'make clean'
|
||||
#CLEANFILES = ${allstamps}
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
|
|
@ -416,8 +416,7 @@ template <typename _Alloc>
|
|||
template <class _ForwardIterator>
|
||||
void _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
|
||||
forward_iterator_tag) {
|
||||
size_type __n = 0;
|
||||
distance(__first, __last, __n);
|
||||
size_type __n = distance(__first, __last);
|
||||
_M_initialize(__n);
|
||||
copy(__first, __last, _M_start);
|
||||
}
|
||||
|
@ -437,8 +436,7 @@ template <typename _Alloc>
|
|||
_ForwardIterator __first, _ForwardIterator __last,
|
||||
forward_iterator_tag) {
|
||||
if (__first != __last) {
|
||||
size_type __n = 0;
|
||||
distance(__first, __last, __n);
|
||||
size_type __n = distance(__first, __last);
|
||||
if (capacity() - size() >= __n) {
|
||||
copy_backward(__position, end(), _M_finish + difference_type(__n));
|
||||
copy(__first, __last, __position);
|
||||
|
@ -600,8 +598,7 @@ template <typename _Alloc>
|
|||
template <class _ForwardIterator>
|
||||
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
|
||||
forward_iterator_tag) {
|
||||
size_type __len = 0;
|
||||
distance(__first, __last, __len);
|
||||
size_type __len = distance(__first, __last);
|
||||
if (__len < size())
|
||||
erase(copy(__first, __last, begin()), end());
|
||||
else {
|
||||
|
|
|
@ -695,8 +695,7 @@ private: // helper functions for assign()
|
|||
template <class _ForwardIterator>
|
||||
void _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
|
||||
forward_iterator_tag) {
|
||||
size_type __len = 0;
|
||||
distance(__first, __last, __len);
|
||||
size_type __len = distance(__first, __last);
|
||||
if (__len > size()) {
|
||||
_ForwardIterator __mid = __first;
|
||||
advance(__mid, size());
|
||||
|
@ -1097,8 +1096,7 @@ void deque<_Tp,_Alloc>::_M_range_initialize(_ForwardIterator __first,
|
|||
_ForwardIterator __last,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type __n = 0;
|
||||
distance(__first, __last, __n);
|
||||
size_type __n = distance(__first, __last);
|
||||
_M_initialize_map(__n);
|
||||
|
||||
_Map_pointer __cur_node;
|
||||
|
@ -1237,8 +1235,7 @@ void
|
|||
deque<_Tp,_Alloc>::insert(iterator __pos,
|
||||
_ForwardIterator __first, _ForwardIterator __last,
|
||||
forward_iterator_tag) {
|
||||
size_type __n = 0;
|
||||
distance(__first, __last, __n);
|
||||
size_type __n = distance(__first, __last);
|
||||
if (__pos._M_cur == _M_start._M_cur) {
|
||||
iterator __new_start = _M_reserve_elements_at_front(__n);
|
||||
try {
|
||||
|
|
|
@ -71,40 +71,6 @@
|
|||
|
||||
namespace std
|
||||
{
|
||||
|
||||
// There are two signatures for distance. In addition to the one taking
|
||||
// two iterators and returning a result, there is another taking two
|
||||
// iterators and a reference-to-result variable, and returning nothing.
|
||||
// The latter seems to be an SGI extension. -- pedwards
|
||||
template<typename _InputIterator, typename _Distance>
|
||||
inline void
|
||||
__distance(_InputIterator __first, _InputIterator __last,
|
||||
_Distance& __n, input_iterator_tag)
|
||||
{
|
||||
// concept requirements
|
||||
__glibcpp_function_requires(_InputIteratorConcept<_InputIterator>)
|
||||
while (__first != __last) { ++__first; ++__n; }
|
||||
}
|
||||
|
||||
template<typename _RandomAccessIterator, typename _Distance>
|
||||
inline void
|
||||
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
_Distance& __n, random_access_iterator_tag)
|
||||
{
|
||||
// concept requirements
|
||||
__glibcpp_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>)
|
||||
__n += __last - __first;
|
||||
}
|
||||
|
||||
template<typename _InputIterator, typename _Distance>
|
||||
inline void
|
||||
distance(_InputIterator __first, _InputIterator __last,
|
||||
_Distance& __n)
|
||||
{
|
||||
// concept requirements -- taken care of in __distance
|
||||
__distance(__first, __last, __n, __iterator_category(__first));
|
||||
}
|
||||
|
||||
template<typename _InputIterator>
|
||||
inline typename iterator_traits<_InputIterator>::difference_type
|
||||
__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
|
||||
|
|
|
@ -137,8 +137,7 @@ public:
|
|||
_Trivial;
|
||||
|
||||
try {
|
||||
_M_len = 0;
|
||||
distance(__first, __last, _M_len);
|
||||
_M_len = distance(__first, __last);
|
||||
_M_allocate_buffer();
|
||||
if (_M_len > 0)
|
||||
_M_initialize_buffer(*__first, _Trivial());
|
||||
|
|
|
@ -1022,8 +1022,7 @@ typename _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::size_type
|
|||
_Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>::erase(const _Key& __x)
|
||||
{
|
||||
pair<iterator,iterator> __p = equal_range(__x);
|
||||
size_type __n = 0;
|
||||
distance(__p.first, __p.second, __n);
|
||||
size_type __n = distance(__p.first, __p.second);
|
||||
erase(__p.first, __p.second);
|
||||
return __n;
|
||||
}
|
||||
|
@ -1139,8 +1138,7 @@ _Rb_tree<_Key,_Value,_KeyOfValue,_Compare,_Alloc>
|
|||
::count(const _Key& __k) const
|
||||
{
|
||||
pair<const_iterator, const_iterator> __p = equal_range(__k);
|
||||
size_type __n = 0;
|
||||
distance(__p.first, __p.second, __n);
|
||||
size_type __n = distance(__p.first, __p.second);
|
||||
return __n;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,8 +462,7 @@ protected:
|
|||
void _M_range_initialize(_ForwardIterator __first,
|
||||
_ForwardIterator __last, forward_iterator_tag)
|
||||
{
|
||||
size_type __n = 0;
|
||||
distance(__first, __last, __n);
|
||||
size_type __n = distance(__first, __last);
|
||||
_M_start = _M_allocate(__n);
|
||||
_M_end_of_storage = _M_start + __n;
|
||||
_M_finish = uninitialized_copy(__first, __last, _M_start);
|
||||
|
@ -583,8 +582,7 @@ template <class _Tp, class _Alloc> template <class _ForwardIter>
|
|||
void
|
||||
vector<_Tp, _Alloc>::_M_assign_aux(_ForwardIter __first, _ForwardIter __last,
|
||||
forward_iterator_tag) {
|
||||
size_type __len = 0;
|
||||
distance(__first, __last, __len);
|
||||
size_type __len = distance(__first, __last);
|
||||
|
||||
if (__len > capacity()) {
|
||||
pointer __tmp(_M_allocate_and_copy(__len, __first, __last));
|
||||
|
@ -752,8 +750,7 @@ vector<_Tp, _Alloc>::_M_range_insert(iterator __position,
|
|||
forward_iterator_tag)
|
||||
{
|
||||
if (__first != __last) {
|
||||
size_type __n = 0;
|
||||
distance(__first, __last, __n);
|
||||
size_type __n = distance(__first, __last);
|
||||
if (size_type(_M_end_of_storage - _M_finish) >= __n) {
|
||||
const size_type __elems_after = end() - __position;
|
||||
iterator __old_finish(_M_finish);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
// HP/SGI iterator extensions -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
//
|
||||
// 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
|
||||
// Free Software Foundation; either version 2, or (at your option)
|
||||
// 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.
|
||||
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this library; see the file COPYING. If not, write to the Free
|
||||
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
// USA.
|
||||
|
||||
// As a special exception, you may use this file as part of a free software
|
||||
// library without restriction. Specifically, if other files instantiate
|
||||
// templates or use macros or inline functions from this file, or you compile
|
||||
// this file and link it with other files to produce an executable, this
|
||||
// file does not by itself cause the resulting executable to be covered by
|
||||
// the GNU General Public License. This exception does not however
|
||||
// invalidate any other reasons why the executable file might be covered by
|
||||
// the GNU General Public License.
|
||||
|
||||
/*
|
||||
*
|
||||
* 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-1998
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* @file dont_know_what_to_call_this_yet
|
||||
* This header file is an extension to the Standard C++ Library. You should
|
||||
* use the "ext/" path prefix in your @c #include statements.
|
||||
*/
|
||||
|
||||
#ifndef _EXT_ITERATOR
|
||||
#define _EXT_ITERATOR
|
||||
|
||||
#pragma GCC system_header
|
||||
#include <bits/concept_check.h>
|
||||
|
||||
namespace __gnu_cxx
|
||||
{
|
||||
|
||||
// There are two signatures for distance. In addition to the one taking
|
||||
// two iterators and returning a result, there is another taking two
|
||||
// iterators and a reference-to-result variable, and returning nothing.
|
||||
// The latter seems to be an SGI extension. -- pedwards
|
||||
template<typename _InputIterator, typename _Distance>
|
||||
inline void
|
||||
__distance(_InputIterator __first, _InputIterator __last,
|
||||
_Distance& __n, input_iterator_tag)
|
||||
{
|
||||
// concept requirements
|
||||
__glibcpp_function_requires(_InputIteratorConcept<_InputIterator>)
|
||||
while (__first != __last) { ++__first; ++__n; }
|
||||
}
|
||||
|
||||
template<typename _RandomAccessIterator, typename _Distance>
|
||||
inline void
|
||||
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
_Distance& __n, random_access_iterator_tag)
|
||||
{
|
||||
// concept requirements
|
||||
__glibcpp_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>)
|
||||
__n += __last - __first;
|
||||
}
|
||||
|
||||
template<typename _InputIterator, typename _Distance>
|
||||
inline void
|
||||
distance(_InputIterator __first, _InputIterator __last,
|
||||
_Distance& __n)
|
||||
{
|
||||
// concept requirements -- taken care of in __distance
|
||||
__distance(__first, __last, __n, __iterator_category(__first));
|
||||
}
|
||||
|
||||
} // namespace __gnu_cxx
|
||||
|
||||
#endif /* _EXT_ITERATOR */
|
||||
|
|
@ -422,8 +422,7 @@ public:
|
|||
void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type __n = 0;
|
||||
distance(__f, __l, __n);
|
||||
size_type __n = distance(__f, __l);
|
||||
resize(_M_num_elements + __n);
|
||||
for ( ; __n > 0; --__n, ++__f)
|
||||
insert_unique_noresize(*__f);
|
||||
|
@ -433,8 +432,7 @@ public:
|
|||
void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
|
||||
forward_iterator_tag)
|
||||
{
|
||||
size_type __n = 0;
|
||||
distance(__f, __l, __n);
|
||||
size_type __n = distance(__f, __l);
|
||||
resize(_M_num_elements + __n);
|
||||
for ( ; __n > 0; --__n, ++__f)
|
||||
insert_equal_noresize(*__f);
|
||||
|
|
Loading…
Reference in New Issue