This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] Move vector<bool>::reserve out of line
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Tue, 11 Dec 2007 20:09:48 +0100
- Subject: [v3] Move vector<bool>::reserve out of line
Hi,
absolutely no need for it to be inline. Tested x86_64-linux, committed
to mainline.
Paolo.
///////////////
2007-12-11 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_bvector.h (vector<bool>::reserve): Move out of
line...
* include/bits/vector.tcc: ... here.
Index: include/bits/vector.tcc
===================================================================
--- include/bits/vector.tcc (revision 130775)
+++ include/bits/vector.tcc (working copy)
@@ -537,6 +537,25 @@
template<typename _Alloc>
void
vector<bool, _Alloc>::
+ reserve(size_type __n)
+ {
+ 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 = _M_copy_aligned(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));
+ }
+ }
+
+ template<typename _Alloc>
+ void
+ vector<bool, _Alloc>::
_M_fill_insert(iterator __position, size_type __n, bool __x)
{
if (__n == 0)
Index: include/bits/stl_bvector.h
===================================================================
--- include/bits/stl_bvector.h (revision 130775)
+++ include/bits/stl_bvector.h (working copy)
@@ -690,21 +690,7 @@
{ _M_range_check(__n); return (*this)[__n]; }
void
- reserve(size_type __n)
- {
- 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 = _M_copy_aligned(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));
- }
- }
+ reserve(size_type __n);
reference
front()