2004-04-16 21:04:07 +02:00
|
|
|
// vector<bool> specialization -*- C++ -*-
|
2001-06-27 19:09:53 +02:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
|
|
|
|
// Free Software Foundation, Inc.
|
2001-06-27 19:09:53 +02: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
|
|
|
|
// 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
|
2005-08-17 04:28:44 +02:00
|
|
|
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
2001-06-27 19:09:53 +02:00
|
|
|
// 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.
|
|
|
|
|
2000-10-05 13:27:02 +02: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-1999
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
c_io_stdio.h: Correct grammar in comments.
2001-11-02 Phil Edwards <pme@gcc.gnu.org>
* config/io/c_io_stdio.h: Correct grammar in comments.
* docs/doxygen/Intro.3: Expand "top-level" man page.
* docs/doxygen/doxygroups.cc: New module definitions (comments).
* docs/doxygen/mainpage.doxy: Tweaks.
* docs/doxygen/run_doxygen: Update Doxygen version, massage man pages.
Add @file hooks so that headers are considered to be documented.
* include/bits/basic_ios.h, include/bits/basic_file.h,
include/bits/basic_string.h, include/bits/boost_concept_check.h,
include/bits/char_traits.h, include/bits/codecvt.h,
include/bits/concept_check.h, include/bits/cpp_type_traits.h,
include/bits/fpos.h, include/bits/gslice.h, include/bits/gslice_array.h,
include/bits/indirect_array.h, include/bits/ios_base.h,
include/bits/locale_facets.h, include/bits/localefwd.h,
include/bits/mask_array.h, include/bits/pthread_allocimpl.h,
include/bits/slice.h, include/bits/slice_array.h,
include/bits/std_algorithm.h, include/bits/std_bitset.h,
include/bits/std_complex.h, include/bits/std_deque.h,
include/bits/std_fstream.h, include/bits/std_functional.h,
include/bits/std_iomanip.h, include/bits/std_ios.h,
include/bits/std_iosfwd.h, include/bits/std_iostream.h,
include/bits/std_istream.h, include/bits/std_iterator.h,
include/bits/std_limits.h, include/bits/std_list.h,
include/bits/std_locale.h, include/bits/std_map.h,
include/bits/std_memory.h, include/bits/std_numeric.h,
include/bits/std_ostream.h, include/bits/std_queue.h,
include/bits/std_set.h, include/bits/std_sstream.h,
include/bits/std_stack.h, include/bits/std_streambuf.h,
include/bits/std_string.h, include/bits/std_utility.h,
include/bits/std_valarray.h, include/bits/std_vector.h,
include/bits/stl_algo.h, include/bits/stl_alloc.h,
include/bits/stl_bvector.h, include/bits/stl_construct.h,
include/bits/stl_deque.h, include/bits/stl_heap.h,
include/bits/stl_iterator.h, include/bits/stl_iterator_base_funcs.h,
include/bits/stl_iterator_base_types.h, include/bits/stl_list.h,
include/bits/stl_map.h, include/bits/stl_multimap.h,
include/bits/stl_multiset.h, include/bits/stl_numeric.h,
include/bits/stl_pair.h, include/bits/stl_pthread_alloc.h,
include/bits/stl_queue.h, include/bits/stl_raw_storage_iter.h,
include/bits/stl_relops.h, include/bits/stl_set.h,
include/bits/stl_stack.h, include/bits/stl_tempbuf.h,
include/bits/stl_threads.h, include/bits/stl_tree.h,
include/bits/stl_uninitialized.h, include/bits/stl_vector.h,
include/bits/stream_iterator.h, include/bits/streambuf_iterator.h,
include/bits/stringfwd.h, include/bits/type_traits.h,
include/bits/valarray_array.h, include/bits/valarray_meta.h:
Add hooks, tweak comments only.
* include/bits/stl_algobase.h (swap, min, iter_swap): Also
document these functions.
* include/bits/stl_function.h: Tweak link comments.
From-SVN: r46717
2001-11-02 18:38:11 +01:00
|
|
|
/** @file stl_bvector.h
|
|
|
|
* This is an internal header file, included by other library headers.
|
|
|
|
* You should not attempt to use it directly.
|
2000-10-05 13:27:02 +02:00
|
|
|
*/
|
|
|
|
|
2003-07-05 06:05:45 +02:00
|
|
|
#ifndef _BVECTOR_H
|
|
|
|
#define _BVECTOR_H 1
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
|
|
|
|
|
2002-03-11 23:36:30 +01:00
|
|
|
typedef unsigned long _Bit_type;
|
2005-04-28 09:50:48 +02:00
|
|
|
enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) };
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
struct _Bit_reference
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_Bit_type * _M_p;
|
|
|
|
_Bit_type _M_mask;
|
2002-03-11 23:36:30 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_reference(_Bit_type * __x, _Bit_type __y)
|
2004-01-29 01:18:40 +01:00
|
|
|
: _M_p(__x), _M_mask(__y) { }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
_Bit_reference() : _M_p(0), _M_mask(0) { }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
operator bool() const
|
|
|
|
{ return !!(*_M_p & _M_mask); }
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_reference&
|
2004-01-29 01:18:40 +01:00
|
|
|
operator=(bool __x)
|
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
if (__x)
|
2004-01-29 01:18:40 +01:00
|
|
|
*_M_p |= _M_mask;
|
2004-02-08 05:46:42 +01:00
|
|
|
else
|
2004-01-29 01:18:40 +01:00
|
|
|
*_M_p &= ~_M_mask;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_reference&
|
|
|
|
operator=(const _Bit_reference& __x)
|
2000-10-05 13:27:02 +02:00
|
|
|
{ return *this = bool(__x); }
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2004-01-29 01:18:40 +01:00
|
|
|
operator==(const _Bit_reference& __x) const
|
2000-10-05 13:27:02 +02:00
|
|
|
{ return bool(*this) == bool(__x); }
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
2004-01-29 01:18:40 +01:00
|
|
|
operator<(const _Bit_reference& __x) const
|
2002-03-11 23:36:30 +01:00
|
|
|
{ return !bool(*this) && bool(__x); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
2004-08-09 15:51:33 +02:00
|
|
|
flip()
|
|
|
|
{ *_M_p ^= _M_mask; }
|
2004-01-29 01:18:40 +01:00
|
|
|
};
|
|
|
|
|
2005-05-10 03:58:19 +02:00
|
|
|
struct _Bit_iterator_base
|
|
|
|
: public std::iterator<std::random_access_iterator_tag, bool>
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_Bit_type * _M_p;
|
|
|
|
unsigned int _M_offset;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
_Bit_iterator_base(_Bit_type * __x, unsigned int __y)
|
|
|
|
: _M_p(__x), _M_offset(__y) { }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
|
|
|
_M_bump_up()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2005-04-28 09:50:48 +02:00
|
|
|
if (_M_offset++ == int(_S_word_bit) - 1)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_offset = 0;
|
|
|
|
++_M_p;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
|
|
|
_M_bump_down()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2004-02-08 05:46:42 +01:00
|
|
|
if (_M_offset-- == 0)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2005-04-28 09:50:48 +02:00
|
|
|
_M_offset = int(_S_word_bit) - 1;
|
2004-01-29 01:18:40 +01:00
|
|
|
--_M_p;
|
|
|
|
}
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
void
|
|
|
|
_M_incr(ptrdiff_t __i)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
difference_type __n = __i + _M_offset;
|
2005-04-28 09:50:48 +02:00
|
|
|
_M_p += __n / int(_S_word_bit);
|
|
|
|
__n = __n % int(_S_word_bit);
|
2004-02-08 05:46:42 +01:00
|
|
|
if (__n < 0)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2005-04-28 09:50:48 +02:00
|
|
|
_M_offset = static_cast<unsigned int>(__n + int(_S_word_bit));
|
2004-01-29 01:18:40 +01:00
|
|
|
--_M_p;
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2004-01-29 01:18:40 +01:00
|
|
|
else
|
|
|
|
_M_offset = static_cast<unsigned int>(__n);
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator==(const _Bit_iterator_base& __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return _M_p == __i._M_p && _M_offset == __i._M_offset; }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator<(const _Bit_iterator_base& __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2004-02-01 12:25:21 +01:00
|
|
|
return _M_p < __i._M_p
|
|
|
|
|| (_M_p == __i._M_p && _M_offset < __i._M_offset);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
|
|
|
operator!=(const _Bit_iterator_base& __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return !(*this == __i); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
bool
|
|
|
|
operator>(const _Bit_iterator_base& __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return __i < *this; }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
|
|
|
operator<=(const _Bit_iterator_base& __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return !(__i < *this); }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
bool
|
|
|
|
operator>=(const _Bit_iterator_base& __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return !(*this < __i); }
|
|
|
|
};
|
|
|
|
|
|
|
|
inline ptrdiff_t
|
2004-02-08 05:46:42 +01:00
|
|
|
operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2005-04-28 09:50:48 +02:00
|
|
|
return (int(_S_word_bit) * (__x._M_p - __y._M_p)
|
|
|
|
+ __x._M_offset - __y._M_offset);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
struct _Bit_iterator : public _Bit_iterator_base
|
|
|
|
{
|
|
|
|
typedef _Bit_reference reference;
|
|
|
|
typedef _Bit_reference* pointer;
|
|
|
|
typedef _Bit_iterator iterator;
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
_Bit_iterator() : _Bit_iterator_base(0, 0) { }
|
2004-08-09 15:51:33 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_iterator(_Bit_type * __x, unsigned int __y)
|
2004-01-29 01:18:40 +01:00
|
|
|
: _Bit_iterator_base(__x, __y) { }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
reference
|
2004-08-09 15:51:33 +02:00
|
|
|
operator*() const
|
|
|
|
{ return reference(_M_p, 1UL << _M_offset); }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator&
|
|
|
|
operator++()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_bump_up();
|
|
|
|
return *this;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
iterator
|
|
|
|
operator++(int)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
iterator __tmp = *this;
|
|
|
|
_M_bump_up();
|
|
|
|
return __tmp;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator&
|
|
|
|
operator--()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_bump_down();
|
|
|
|
return *this;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
|
|
|
operator--(int)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
iterator __tmp = *this;
|
|
|
|
_M_bump_down();
|
|
|
|
return __tmp;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator&
|
|
|
|
operator+=(difference_type __i)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_incr(__i);
|
|
|
|
return *this;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
iterator&
|
2004-02-08 05:46:42 +01:00
|
|
|
operator-=(difference_type __i)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
*this += -__i;
|
|
|
|
return *this;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
iterator
|
|
|
|
operator+(difference_type __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
iterator __tmp = *this;
|
|
|
|
return __tmp += __i;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
iterator
|
|
|
|
operator-(difference_type __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
iterator __tmp = *this;
|
|
|
|
return __tmp -= __i;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
reference
|
2005-08-31 19:01:57 +02:00
|
|
|
operator[](difference_type __i) const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return *(*this + __i); }
|
2004-01-29 01:18:40 +01:00
|
|
|
};
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
inline _Bit_iterator
|
2004-08-09 15:51:33 +02:00
|
|
|
operator+(ptrdiff_t __n, const _Bit_iterator& __x)
|
|
|
|
{ return __x + __n; }
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
struct _Bit_const_iterator : public _Bit_iterator_base
|
|
|
|
{
|
|
|
|
typedef bool reference;
|
|
|
|
typedef bool const_reference;
|
|
|
|
typedef const bool* pointer;
|
|
|
|
typedef _Bit_const_iterator const_iterator;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
_Bit_const_iterator() : _Bit_iterator_base(0, 0) { }
|
2004-08-09 15:51:33 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_const_iterator(_Bit_type * __x, unsigned int __y)
|
2004-01-29 01:18:40 +01:00
|
|
|
: _Bit_iterator_base(__x, __y) { }
|
2004-08-09 15:51:33 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_const_iterator(const _Bit_iterator& __x)
|
2004-01-29 01:18:40 +01:00
|
|
|
: _Bit_iterator_base(__x._M_p, __x._M_offset) { }
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_reference
|
|
|
|
operator*() const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return _Bit_reference(_M_p, 1UL << _M_offset); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
const_iterator&
|
|
|
|
operator++()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_bump_up();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
|
|
|
operator++(int)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
const_iterator __tmp = *this;
|
|
|
|
_M_bump_up();
|
|
|
|
return __tmp;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator&
|
|
|
|
operator--()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_bump_down();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
|
|
|
operator--(int)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
const_iterator __tmp = *this;
|
|
|
|
_M_bump_down();
|
|
|
|
return __tmp;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator&
|
|
|
|
operator+=(difference_type __i)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
_M_incr(__i);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator&
|
|
|
|
operator-=(difference_type __i)
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
*this += -__i;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2004-04-16 21:04:07 +02:00
|
|
|
const_iterator
|
2004-07-04 19:57:58 +02:00
|
|
|
operator+(difference_type __i) const
|
|
|
|
{
|
2004-01-29 01:18:40 +01:00
|
|
|
const_iterator __tmp = *this;
|
|
|
|
return __tmp += __i;
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_iterator
|
|
|
|
operator-(difference_type __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
|
|
|
const_iterator __tmp = *this;
|
|
|
|
return __tmp -= __i;
|
|
|
|
}
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
const_reference
|
2005-08-31 19:01:57 +02:00
|
|
|
operator[](difference_type __i) const
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return *(*this + __i); }
|
|
|
|
};
|
2004-02-08 05:46:42 +01:00
|
|
|
|
|
|
|
inline _Bit_const_iterator
|
|
|
|
operator+(ptrdiff_t __n, const _Bit_const_iterator& __x)
|
2004-01-29 01:18:40 +01:00
|
|
|
{ return __x + __n; }
|
|
|
|
|
|
|
|
template<class _Alloc>
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
struct _Bvector_base
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2004-02-01 12:25:21 +01:00
|
|
|
typedef typename _Alloc::template rebind<_Bit_type>::other
|
|
|
|
_Bit_alloc_type;
|
2004-04-16 21:04:07 +02:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
struct _Bvector_impl
|
|
|
|
: public _Bit_alloc_type
|
2004-04-16 21:04:07 +02:00
|
|
|
{
|
|
|
|
_Bit_iterator _M_start;
|
|
|
|
_Bit_iterator _M_finish;
|
|
|
|
_Bit_type* _M_end_of_storage;
|
|
|
|
_Bvector_impl(const _Bit_alloc_type& __a)
|
|
|
|
: _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)
|
|
|
|
{ }
|
|
|
|
};
|
2004-01-29 01:18:40 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
typedef _Alloc allocator_type;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_Bit_alloc_type&
|
|
|
|
_M_get_Bit_allocator()
|
|
|
|
{ return *static_cast<_Bit_alloc_type*>(&this->_M_impl); }
|
|
|
|
|
|
|
|
const _Bit_alloc_type&
|
|
|
|
_M_get_Bit_allocator() const
|
|
|
|
{ return *static_cast<const _Bit_alloc_type*>(&this->_M_impl); }
|
|
|
|
|
2004-02-01 12:25:21 +01:00
|
|
|
allocator_type
|
2004-02-08 05:46:42 +01:00
|
|
|
get_allocator() const
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
{ return allocator_type(_M_get_Bit_allocator()); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-04-16 21:04:07 +02:00
|
|
|
_Bvector_base(const allocator_type& __a) : _M_impl(__a) { }
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
~_Bvector_base()
|
|
|
|
{ this->_M_deallocate(); }
|
2004-01-29 01:18:40 +01:00
|
|
|
|
|
|
|
protected:
|
2004-04-16 21:04:07 +02:00
|
|
|
_Bvector_impl _M_impl;
|
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
_Bit_type*
|
2004-04-16 21:04:07 +02:00
|
|
|
_M_allocate(size_t __n)
|
2005-04-28 09:50:48 +02:00
|
|
|
{ return _M_impl.allocate((__n + int(_S_word_bit) - 1)
|
|
|
|
/ int(_S_word_bit)); }
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2004-02-08 05:46:42 +01:00
|
|
|
void
|
|
|
|
_M_deallocate()
|
2004-01-29 01:18:40 +01:00
|
|
|
{
|
2004-04-16 21:04:07 +02:00
|
|
|
if (_M_impl._M_start._M_p)
|
|
|
|
_M_impl.deallocate(_M_impl._M_start._M_p,
|
2004-08-09 15:51:33 +02:00
|
|
|
_M_impl._M_end_of_storage - _M_impl._M_start._M_p);
|
2004-02-08 05:46:42 +01:00
|
|
|
}
|
2004-01-29 01:18:40 +01:00
|
|
|
};
|
2005-12-19 01:56:05 +01:00
|
|
|
|
|
|
|
_GLIBCXX_END_NESTED_NAMESPACE
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2001-03-04 22:34:02 +01:00
|
|
|
// Declare a partial specialization of vector<T, Alloc>.
|
|
|
|
#include <bits/stl_vector.h>
|
2004-01-29 01:18:40 +01:00
|
|
|
|
2005-12-19 01:56:05 +01:00
|
|
|
_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)
|
|
|
|
|
2004-01-27 03:58:06 +01:00
|
|
|
/**
|
|
|
|
* @brief A specialization of vector for booleans which offers fixed time
|
|
|
|
* access to individual elements in any order.
|
|
|
|
*
|
|
|
|
* Note that vector<bool> does not actually meet the requirements for being
|
|
|
|
* a container. This is because the reference and pointer types are not
|
|
|
|
* really references and pointers to bool. See DR96 for details. @see
|
|
|
|
* vector for function documentation.
|
|
|
|
*
|
|
|
|
* @ingroup Containers
|
|
|
|
* @ingroup Sequences
|
|
|
|
*
|
2004-01-29 01:18:40 +01:00
|
|
|
* In some terminology a %vector can be described as a dynamic
|
|
|
|
* C-style array, it offers fast and efficient access to individual
|
|
|
|
* elements in any order and saves the user from worrying about
|
|
|
|
* memory and size allocation. Subscripting ( @c [] ) access is
|
|
|
|
* also provided as with C-style arrays.
|
2004-01-27 03:58:06 +01:00
|
|
|
*/
|
2004-02-08 05:46:42 +01:00
|
|
|
template<typename _Alloc>
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
class vector<bool, _Alloc> : protected _Bvector_base<_Alloc>
|
2001-03-04 22:34:02 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
typedef _Bvector_base<_Alloc> _Base;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
public:
|
|
|
|
typedef bool value_type;
|
|
|
|
typedef size_t size_type;
|
|
|
|
typedef ptrdiff_t difference_type;
|
|
|
|
typedef _Bit_reference reference;
|
|
|
|
typedef bool const_reference;
|
|
|
|
typedef _Bit_reference* pointer;
|
|
|
|
typedef const bool* const_pointer;
|
|
|
|
typedef _Bit_iterator iterator;
|
|
|
|
typedef _Bit_const_iterator const_iterator;
|
|
|
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
|
|
|
typedef std::reverse_iterator<iterator> reverse_iterator;
|
|
|
|
typedef _Alloc allocator_type;
|
2004-02-01 12:25:21 +01:00
|
|
|
|
|
|
|
allocator_type get_allocator() const
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
{ return _Base::get_allocator(); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2001-03-04 22:34:02 +01:00
|
|
|
protected:
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
using _Base::_M_allocate;
|
|
|
|
using _Base::_M_deallocate;
|
|
|
|
using _Base::_M_get_Bit_allocator;
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
public:
|
|
|
|
explicit
|
|
|
|
vector(const allocator_type& __a = allocator_type())
|
|
|
|
: _Base(__a) { }
|
|
|
|
|
|
|
|
explicit
|
|
|
|
vector(size_type __n, const bool& __value = bool(),
|
|
|
|
const allocator_type& __a = allocator_type())
|
|
|
|
: _Base(__a)
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_initialize(__n);
|
|
|
|
std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage,
|
|
|
|
__value ? ~0 : 0);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2004-02-01 12:25:21 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
vector(const vector& __x)
|
|
|
|
: _Base(__x._M_get_Bit_allocator())
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_initialize(__x.size());
|
|
|
|
std::copy(__x.begin(), __x.end(), this->_M_impl._M_start);
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _InputIterator>
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
vector(_InputIterator __first, _InputIterator __last,
|
|
|
|
const allocator_type& __a = allocator_type())
|
|
|
|
: _Base(__a)
|
2004-08-09 15:51:33 +02:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
|
|
|
|
_M_initialize_dispatch(__first, __last, _Integral());
|
2004-08-09 15:51:33 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
~vector() { }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
vector&
|
|
|
|
operator=(const vector& __x)
|
|
|
|
{
|
|
|
|
if (&__x == this)
|
|
|
|
return *this;
|
|
|
|
if (__x.size() > capacity())
|
|
|
|
{
|
|
|
|
this->_M_deallocate();
|
|
|
|
_M_initialize(__x.size());
|
|
|
|
}
|
|
|
|
std::copy(__x.begin(), __x.end(), begin());
|
|
|
|
this->_M_impl._M_finish = begin() + difference_type(__x.size());
|
|
|
|
return *this;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
// assign(), a generalized assignment member function. Two
|
|
|
|
// versions: one that takes a count, and one that takes a range.
|
|
|
|
// The range version is a member template, so we dispatch on whether
|
|
|
|
// or not the type is an integer.
|
|
|
|
void
|
|
|
|
assign(size_type __n, const bool& __x)
|
|
|
|
{ _M_fill_assign(__n, __x); }
|
|
|
|
|
|
|
|
template<class _InputIterator>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
assign(_InputIterator __first, _InputIterator __last)
|
2004-08-09 15:51:33 +02:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
|
|
|
|
_M_assign_dispatch(__first, __last, _Integral());
|
2004-08-09 15:51:33 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
iterator
|
|
|
|
begin()
|
2004-04-16 21:04:07 +02:00
|
|
|
{ return this->_M_impl._M_start; }
|
2004-02-01 12:25:21 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
const_iterator
|
|
|
|
begin() const
|
2004-04-16 21:04:07 +02:00
|
|
|
{ return this->_M_impl._M_start; }
|
2004-02-01 12:25:21 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
iterator
|
|
|
|
end()
|
2004-04-16 21:04:07 +02:00
|
|
|
{ return this->_M_impl._M_finish; }
|
2004-02-01 12:25:21 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
const_iterator
|
|
|
|
end() const
|
2004-04-16 21:04:07 +02:00
|
|
|
{ return this->_M_impl._M_finish; }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
reverse_iterator
|
|
|
|
rbegin()
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return reverse_iterator(end()); }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
const_reverse_iterator
|
|
|
|
rbegin() const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return const_reverse_iterator(end()); }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
reverse_iterator
|
|
|
|
rend()
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return reverse_iterator(begin()); }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
const_reverse_iterator
|
|
|
|
rend() const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return const_reverse_iterator(begin()); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
size_type
|
|
|
|
size() const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return size_type(end() - begin()); }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
size_type
|
|
|
|
max_size() const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return size_type(-1); }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
size_type
|
|
|
|
capacity() const
|
2004-04-16 21:04:07 +02:00
|
|
|
{ return size_type(const_iterator(this->_M_impl._M_end_of_storage, 0)
|
2004-02-01 12:25:21 +01:00
|
|
|
- begin()); }
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
bool
|
|
|
|
empty() const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return begin() == end(); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
reference
|
|
|
|
operator[](size_type __n)
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return *(begin() + difference_type(__n)); }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
const_reference
|
|
|
|
operator[](size_type __n) const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ return *(begin() + difference_type(__n)); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
protected:
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_range_check(size_type __n) const
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
2001-03-04 22:34:02 +01:00
|
|
|
if (__n >= this->size())
|
2003-04-29 01:05:57 +02:00
|
|
|
__throw_out_of_range(__N("vector<bool>::_M_range_check"));
|
2001-03-04 22:34:02 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
public:
|
2004-08-09 15:51:33 +02:00
|
|
|
reference
|
|
|
|
at(size_type __n)
|
2004-02-01 12:25:21 +01:00
|
|
|
{ _M_range_check(__n); return (*this)[__n]; }
|
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
const_reference
|
|
|
|
at(size_type __n) const
|
2004-02-01 12:25:21 +01:00
|
|
|
{ _M_range_check(__n); return (*this)[__n]; }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
void
|
|
|
|
reserve(size_type __n)
|
2001-03-04 22:34:02 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
if (__n > this->max_size())
|
|
|
|
__throw_length_error(__N("vector::reserve"));
|
|
|
|
if (this->capacity() < __n)
|
|
|
|
{
|
|
|
|
_Bit_type* __q = this->_M_allocate(__n);
|
|
|
|
this->_M_impl._M_finish = std::copy(begin(), end(),
|
|
|
|
iterator(__q, 0));
|
|
|
|
this->_M_deallocate();
|
|
|
|
this->_M_impl._M_start = iterator(__q, 0);
|
|
|
|
this->_M_impl._M_end_of_storage = (__q + (__n + int(_S_word_bit) - 1)
|
|
|
|
/ int(_S_word_bit));
|
|
|
|
}
|
2001-03-04 22:34:02 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
reference
|
|
|
|
front()
|
|
|
|
{ return *begin(); }
|
|
|
|
|
|
|
|
const_reference
|
|
|
|
front() const
|
|
|
|
{ return *begin(); }
|
|
|
|
|
|
|
|
reference
|
|
|
|
back()
|
|
|
|
{ return *(end() - 1); }
|
|
|
|
|
|
|
|
const_reference
|
|
|
|
back() const
|
|
|
|
{ return *(end() - 1); }
|
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// DR 464. Suggestion for new member functions in standard containers.
|
|
|
|
// N.B. DR 464 says nothing about vector<bool> but we need something
|
|
|
|
// here due to the way we are implementing DR 464 in the debug-mode
|
|
|
|
// vector class.
|
|
|
|
void
|
|
|
|
data() { }
|
|
|
|
|
|
|
|
void
|
|
|
|
push_back(bool __x)
|
2001-03-04 22:34:02 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
|
|
|
|
*this->_M_impl._M_finish++ = __x;
|
|
|
|
else
|
|
|
|
_M_insert_aux(end(), __x);
|
2001-03-04 22:34:02 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
void
|
|
|
|
swap(vector<bool, _Alloc>& __x)
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
|
|
|
|
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
|
|
|
|
std::swap(this->_M_impl._M_end_of_storage,
|
|
|
|
__x._M_impl._M_end_of_storage);
|
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// 431. Swapping containers with unequal allocators.
|
|
|
|
std::__alloc_swap<typename _Base::_Bit_alloc_type>::
|
|
|
|
_S_do_it(_M_get_Bit_allocator(), __x._M_get_Bit_allocator());
|
2001-03-04 22:34:02 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
// [23.2.5]/1, third-to-last entry in synopsis listing
|
|
|
|
static void
|
|
|
|
swap(reference __x, reference __y)
|
|
|
|
{
|
|
|
|
bool __tmp = __x;
|
|
|
|
__x = __y;
|
|
|
|
__y = __tmp;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
iterator
|
|
|
|
insert(iterator __position, const bool& __x = bool())
|
|
|
|
{
|
|
|
|
const difference_type __n = __position - begin();
|
|
|
|
if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage
|
|
|
|
&& __position == end())
|
|
|
|
*this->_M_impl._M_finish++ = __x;
|
|
|
|
else
|
|
|
|
_M_insert_aux(__position, __x);
|
|
|
|
return begin() + __n;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _InputIterator>
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
void
|
|
|
|
insert(iterator __position,
|
|
|
|
_InputIterator __first, _InputIterator __last)
|
2004-08-09 15:51:33 +02:00
|
|
|
{
|
cpp_type_traits.h: Add types to the structs thus making type_traits.h redundant...
2005-01-31 Paolo Carlini <pcarlini@suse.de>
Gabriel Dos Reis <gdr@integrable-solutions.net>
* include/bits/cpp_type_traits.h: Add types to the structs thus
making type_traits.h redundant; exploit new __truth_type and
__traitor helpers.
* include/bits/type_traits.h: Remove.
* include/Makefile.am: Update.
* include/Makefile.in: Regenerate.
* include/backward/tempbuf.h: Include cpp_type_traits.h instead.
* include/bits/basic_string.h (replace(iterator, iterator,
_InputIterator, _InputIterator), _S_construct(_InIterator,
_InIterator, const _Alloc&)): Use __is_integer instead.
* include/bits/stl_bvector.h (vector(_InputIterator,
_InputIterator, const allocator_type&), assign(_InputIterator,
_InputIterator), insert(iterator, _InputIterator, _InputIterator)):
Likewise.
* include/bits/stl_construct.h (_Destroy(_ForwardIterator,
_ForwardIterator)): Use __is_scalar.
* include/bits/stl_deque.h (deque(_InputIterator, _InputIterator,
const allocator_type&), assign(_InputIterator, _InputIterator),
insert(iterator, _InputIterator, _InputIterator)): Use __is_integer.
* include/bits/stl_list.h (assign(_InputIterator, _InputIterator),
insert(iterator, _InputIterator, _InputIterator)): Likewise.
* include/bits/stl_tempbuf.h (_Temporary_buffer(_ForwardIterator,
_ForwardIterator)): Use __is_scalar.
* include/bits/stl_uninitialized.h (uninitialized_copy(_InputIterator,
_InputIterator, _ForwardIterator), uninitialized_fill(_ForwardIterator,
_ForwardIterator, const _Tp&), uninitialized_fill_n(_ForwardIterator,
_Size, const _Tp&)): Likewise.
* include/bits/stl_vector.h (vector(_InputIterator, _InputIterator,
const allocator_type&), assign(_InputIterator, _InputIterator),
insert(iterator, _InputIterator, _InputIterator)): Use __is_integer.
* include/debug/debug.h (__valid_range(const _InputIterator&,
const _InputIterator&)): Use __is_integer.
* include/ext/slist (assign(_InputIterator, _InputIterator)): Likewise.
* include/std/std_string.h: Include cpp_type_traits.h instead.
Co-Authored-By: Gabriel Dos Reis <gdr@integrable-solutions.net>
From-SVN: r94484
2005-01-31 17:22:01 +01:00
|
|
|
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_insert_dispatch(__position, __first, __last, _Integral());
|
2004-08-09 15:51:33 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
void
|
|
|
|
insert(iterator __position, size_type __n, const bool& __x)
|
|
|
|
{ _M_fill_insert(__position, __n, __x); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
void
|
|
|
|
pop_back()
|
|
|
|
{ --this->_M_impl._M_finish; }
|
|
|
|
|
|
|
|
iterator
|
|
|
|
erase(iterator __position)
|
|
|
|
{
|
|
|
|
if (__position + 1 != end())
|
|
|
|
std::copy(__position + 1, end(), __position);
|
|
|
|
--this->_M_impl._M_finish;
|
|
|
|
return __position;
|
2001-03-04 22:34:02 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
iterator
|
|
|
|
erase(iterator __first, iterator __last)
|
|
|
|
{
|
|
|
|
_M_erase_at_end(std::copy(__last, end(), __first));
|
|
|
|
return __first;
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
resize(size_type __new_size, bool __x = bool())
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
if (__new_size < size())
|
|
|
|
_M_erase_at_end(begin() + difference_type(__new_size));
|
2004-02-01 12:25:21 +01:00
|
|
|
else
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
insert(end(), __new_size - size(), __x);
|
2001-03-04 22:34:02 +01:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
flip()
|
|
|
|
{
|
|
|
|
for (_Bit_type * __p = this->_M_impl._M_start._M_p;
|
|
|
|
__p != this->_M_impl._M_end_of_storage; ++__p)
|
|
|
|
*__p = ~*__p;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clear()
|
|
|
|
{ _M_erase_at_end(begin()); }
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void
|
|
|
|
_M_initialize(size_type __n)
|
|
|
|
{
|
|
|
|
_Bit_type* __q = this->_M_allocate(__n);
|
|
|
|
this->_M_impl._M_end_of_storage = (__q
|
|
|
|
+ ((__n + int(_S_word_bit) - 1)
|
|
|
|
/ int(_S_word_bit)));
|
|
|
|
this->_M_impl._M_start = iterator(__q, 0);
|
|
|
|
this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check whether it's an integral type. If so, it's not an iterator.
|
|
|
|
template<class _Integer>
|
|
|
|
void
|
|
|
|
_M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)
|
|
|
|
{
|
|
|
|
_M_initialize(__n);
|
|
|
|
std::fill(this->_M_impl._M_start._M_p,
|
|
|
|
this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class _InputIterator>
|
|
|
|
void
|
|
|
|
_M_initialize_dispatch(_InputIterator __first, _InputIterator __last,
|
|
|
|
__false_type)
|
|
|
|
{ _M_initialize_range(__first, __last,
|
|
|
|
std::__iterator_category(__first)); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _InputIterator>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_initialize_range(_InputIterator __first, _InputIterator __last,
|
|
|
|
std::input_iterator_tag)
|
2004-08-09 15:51:33 +02:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
this->_M_impl._M_start = iterator();
|
|
|
|
this->_M_impl._M_finish = iterator();
|
|
|
|
this->_M_impl._M_end_of_storage = 0;
|
|
|
|
for (; __first != __last; ++__first)
|
|
|
|
push_back(*__first);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class _ForwardIterator>
|
|
|
|
void
|
|
|
|
_M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,
|
|
|
|
std::forward_iterator_tag)
|
|
|
|
{
|
|
|
|
const size_type __n = std::distance(__first, __last);
|
|
|
|
_M_initialize(__n);
|
|
|
|
std::copy(__first, __last, this->_M_impl._M_start);
|
2004-08-09 15:51:33 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _Integer>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
|
|
|
|
{ _M_fill_assign((size_t) __n, (bool) __val); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _InputIterator>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_assign_dispatch(_InputIterator __first, _InputIterator __last,
|
|
|
|
__false_type)
|
|
|
|
{ _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
void
|
|
|
|
_M_fill_assign(size_t __n, bool __x)
|
|
|
|
{
|
|
|
|
if (__n > size())
|
|
|
|
{
|
|
|
|
std::fill(this->_M_impl._M_start._M_p,
|
|
|
|
this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
|
|
|
|
insert(end(), __n - size(), __x);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_M_erase_at_end(begin() + __n);
|
|
|
|
std::fill(this->_M_impl._M_start._M_p,
|
|
|
|
this->_M_impl._M_end_of_storage, __x ? ~0 : 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _InputIterator>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_assign_aux(_InputIterator __first, _InputIterator __last,
|
2005-05-10 03:58:19 +02:00
|
|
|
std::input_iterator_tag)
|
2004-08-09 15:51:33 +02:00
|
|
|
{
|
|
|
|
iterator __cur = begin();
|
|
|
|
for (; __first != __last && __cur != end(); ++__cur, ++__first)
|
|
|
|
*__cur = *__first;
|
|
|
|
if (__first == __last)
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_erase_at_end(__cur);
|
2004-08-09 15:51:33 +02:00
|
|
|
else
|
|
|
|
insert(end(), __first, __last);
|
|
|
|
}
|
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _ForwardIterator>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,
|
2005-05-10 03:58:19 +02:00
|
|
|
std::forward_iterator_tag)
|
2004-08-09 15:51:33 +02:00
|
|
|
{
|
|
|
|
const size_type __len = std::distance(__first, __last);
|
|
|
|
if (__len < size())
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_erase_at_end(std::copy(__first, __last, begin()));
|
2004-08-09 15:51:33 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
_ForwardIterator __mid = __first;
|
|
|
|
std::advance(__mid, size());
|
|
|
|
std::copy(__first, __mid, begin());
|
|
|
|
insert(end(), __mid, __last);
|
|
|
|
}
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2001-03-04 22:34:02 +01:00
|
|
|
// Check whether it's an integral type. If so, it's not an iterator.
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _Integer>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,
|
|
|
|
__true_type)
|
|
|
|
{ _M_fill_insert(__pos, __n, __x); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-01-29 01:18:40 +01:00
|
|
|
template<class _InputIterator>
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_insert_dispatch(iterator __pos,
|
|
|
|
_InputIterator __first, _InputIterator __last,
|
|
|
|
__false_type)
|
|
|
|
{ _M_insert_range(__pos, __first, __last,
|
|
|
|
std::__iterator_category(__first)); }
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
|
|
|
_M_fill_insert(iterator __position, size_type __n, bool __x)
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
|
|
|
if (__n == 0)
|
|
|
|
return;
|
|
|
|
if (capacity() - size() >= __n)
|
|
|
|
{
|
|
|
|
std::copy_backward(__position, end(),
|
2004-04-16 21:04:07 +02:00
|
|
|
this->_M_impl._M_finish + difference_type(__n));
|
2004-02-01 12:25:21 +01:00
|
|
|
std::fill(__position, __position + difference_type(__n), __x);
|
2004-04-16 21:04:07 +02:00
|
|
|
this->_M_impl._M_finish += difference_type(__n);
|
2004-02-01 12:25:21 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const size_type __len = size() + std::max(size(), __n);
|
2004-04-16 21:04:07 +02:00
|
|
|
_Bit_type * __q = this->_M_allocate(__len);
|
2004-02-01 12:25:21 +01:00
|
|
|
iterator __i = std::copy(begin(), __position, iterator(__q, 0));
|
|
|
|
std::fill_n(__i, __n, __x);
|
2004-04-16 21:04:07 +02:00
|
|
|
this->_M_impl._M_finish = std::copy(__position, end(),
|
|
|
|
__i + difference_type(__n));
|
2004-02-01 12:25:21 +01:00
|
|
|
this->_M_deallocate();
|
2005-04-28 09:50:48 +02:00
|
|
|
this->_M_impl._M_end_of_storage = (__q + ((__len
|
|
|
|
+ int(_S_word_bit) - 1)
|
|
|
|
/ int(_S_word_bit)));
|
2004-04-16 21:04:07 +02:00
|
|
|
this->_M_impl._M_start = iterator(__q, 0);
|
2004-02-01 12:25:21 +01:00
|
|
|
}
|
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
template<class _InputIterator>
|
|
|
|
void
|
|
|
|
_M_insert_range(iterator __pos, _InputIterator __first,
|
|
|
|
_InputIterator __last, std::input_iterator_tag)
|
|
|
|
{
|
|
|
|
for (; __first != __last; ++__first)
|
|
|
|
{
|
|
|
|
__pos = insert(__pos, *__first);
|
|
|
|
++__pos;
|
|
|
|
}
|
|
|
|
}
|
2004-02-01 12:25:21 +01:00
|
|
|
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
template<class _ForwardIterator>
|
|
|
|
void
|
|
|
|
_M_insert_range(iterator __position, _ForwardIterator __first,
|
|
|
|
_ForwardIterator __last, std::forward_iterator_tag)
|
|
|
|
{
|
|
|
|
if (__first != __last)
|
|
|
|
{
|
|
|
|
size_type __n = std::distance(__first, __last);
|
|
|
|
if (capacity() - size() >= __n)
|
|
|
|
{
|
|
|
|
std::copy_backward(__position, end(),
|
|
|
|
this->_M_impl._M_finish
|
|
|
|
+ difference_type(__n));
|
|
|
|
std::copy(__first, __last, __position);
|
|
|
|
this->_M_impl._M_finish += difference_type(__n);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const size_type __len = size() + std::max(size(), __n);
|
|
|
|
_Bit_type * __q = this->_M_allocate(__len);
|
|
|
|
iterator __i = std::copy(begin(), __position,
|
|
|
|
iterator(__q, 0));
|
|
|
|
__i = std::copy(__first, __last, __i);
|
|
|
|
this->_M_impl._M_finish = std::copy(__position, end(), __i);
|
|
|
|
this->_M_deallocate();
|
|
|
|
this->_M_impl._M_end_of_storage = (__q
|
|
|
|
+ ((__len
|
|
|
|
+ int(_S_word_bit) - 1)
|
|
|
|
/ int(_S_word_bit)));
|
|
|
|
this->_M_impl._M_start = iterator(__q, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-02-01 12:25:21 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_insert_aux(iterator __position, bool __x)
|
2004-02-01 12:25:21 +01:00
|
|
|
{
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)
|
|
|
|
{
|
|
|
|
std::copy_backward(__position, this->_M_impl._M_finish,
|
|
|
|
this->_M_impl._M_finish + 1);
|
|
|
|
*__position = __x;
|
|
|
|
++this->_M_impl._M_finish;
|
|
|
|
}
|
2001-03-04 22:34:02 +01:00
|
|
|
else
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
{
|
|
|
|
const size_type __len = size() ? 2 * size()
|
|
|
|
: static_cast<size_type>(_S_word_bit);
|
|
|
|
_Bit_type * __q = this->_M_allocate(__len);
|
|
|
|
iterator __i = std::copy(begin(), __position, iterator(__q, 0));
|
|
|
|
*__i++ = __x;
|
|
|
|
this->_M_impl._M_finish = std::copy(__position, end(), __i);
|
|
|
|
this->_M_deallocate();
|
|
|
|
this->_M_impl._M_end_of_storage = (__q + ((__len
|
|
|
|
+ int(_S_word_bit) - 1)
|
|
|
|
/ int(_S_word_bit)));
|
|
|
|
this->_M_impl._M_start = iterator(__q, 0);
|
|
|
|
}
|
2000-10-05 13:27:02 +02:00
|
|
|
}
|
2004-02-08 05:46:42 +01:00
|
|
|
|
2004-08-09 15:51:33 +02:00
|
|
|
void
|
stl_bvector.h (vector<bool>::erase(iterator, iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::erase(iterator,
iterator)): Just use _M_erase_at_end.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (class vector<bool>): Move all the
helpers under protected access mode, consistently with the primary
vector template.
(vector<bool>::_M_erase_at_end): Add.
(erase(iterator, iterator), clear, resize, _M_fill_assign,
_M_assign_aux): Use it.
* testsuite/23_containers/vector/bool/modifiers/erase/1.cc: New.
2006-01-06 Paolo Carlini <pcarlini@suse.de>
Implement Option 3 of DR 431 for vector<bool>.
* include/bits/stl_bvector.h (class _Bvector_base): Change to
a struct, consistently with the primary vector template.
(class vector<bool>): Adjust to protected inheritance, tidy
typedefs.
(_Bvector_base<>::_M_get_Bit_allocator): Add.
(vector<bool>::vector(const vector&)): Use it.
(_Bvector_base<>::get_allocator): Tidy.
(vector<bool>::swap): Use __alloc_swap.
* testsuite/23_containers/vector/bool/modifiers/swap/1.cc: New.
* testsuite/23_containers/vector/bool/modifiers/swap/2.cc: New.
From-SVN: r109415
2006-01-06 12:23:02 +01:00
|
|
|
_M_erase_at_end(iterator __pos)
|
|
|
|
{ this->_M_impl._M_finish = __pos; }
|
2001-03-04 22:34:02 +01:00
|
|
|
};
|
2005-12-19 01:56:05 +01:00
|
|
|
|
|
|
|
_GLIBCXX_END_NESTED_NAMESPACE
|
2000-10-05 13:27:02 +02:00
|
|
|
|
2004-02-01 12:25:21 +01:00
|
|
|
#endif
|