From c62df8fddbe78c4af764227a36fd67fef8d2d665 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 11 Dec 2007 19:08:26 +0000 Subject: [PATCH] stl_bvector.h (vector::reserve): Move out of line... 2007-12-11 Paolo Carlini * include/bits/stl_bvector.h (vector::reserve): Move out of line... * include/bits/vector.tcc: ... here. From-SVN: r130777 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/stl_bvector.h | 16 +--------------- libstdc++-v3/include/bits/vector.tcc | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d374db8c53a5..a318ac84282a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2007-12-11 Paolo Carlini + + * include/bits/stl_bvector.h (vector::reserve): Move out of + line... + * include/bits/vector.tcc: ... here. + 2007-12-10 Jonathan Wakely * docs/html/21_strings/howto.html: Add links to referenced articles. diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 255e00b793c7..045f20378a6d 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -690,21 +690,7 @@ template { _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() diff --git a/libstdc++-v3/include/bits/vector.tcc b/libstdc++-v3/include/bits/vector.tcc index 354ab73f10f6..030cb3aabcce 100644 --- a/libstdc++-v3/include/bits/vector.tcc +++ b/libstdc++-v3/include/bits/vector.tcc @@ -534,6 +534,25 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) // vector + template + void + vector:: + 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 void vector:: -- 2.47.2