Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74794 - branches/release/boost/container
From: igaztanaga_at_[hidden]
Date: 2011-10-08 06:01:51


Author: igaztanaga
Date: 2011-10-08 06:01:51 EDT (Sat, 08 Oct 2011)
New Revision: 74794
URL: http://svn.boost.org/trac/boost/changeset/74794

Log:
Fixed bug in range insertion
Text files modified:
   branches/release/boost/container/vector.hpp | 22 +++++++++++-----------
   1 files changed, 11 insertions(+), 11 deletions(-)

Modified: branches/release/boost/container/vector.hpp
==============================================================================
--- branches/release/boost/container/vector.hpp (original)
+++ branches/release/boost/container/vector.hpp 2011-10-08 06:01:51 EDT (Sat, 08 Oct 2011)
@@ -1320,12 +1320,20 @@
    }
 
    template <class FwdIt>
- void priv_range_insert(pointer pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
+ void priv_range_insert(const_iterator pos, FwdIt first, FwdIt last, std::forward_iterator_tag)
    {
       if(first != last){
          const size_type n = std::distance(first, last);
          containers_detail::advanced_insert_aux_proxy<T, FwdIt, T*> proxy(first, last);
- priv_range_insert(pos, n, proxy);
+ priv_range_insert(pos.get_ptr(), n, proxy);
+ }
+ }
+
+ template <class InIt>
+ void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag)
+ {
+ for(;first != last; ++first){
+ this->emplace(pos, *first);
       }
    }
 
@@ -1756,14 +1764,6 @@
    }
 
    template <class InIt>
- void priv_range_insert(const_iterator pos, InIt first, InIt last, std::input_iterator_tag)
- {
- for(;first != last; ++first){
- this->insert(pos, ::boost::move(value_type(*first)));
- }
- }
-
- template <class InIt>
    void priv_assign_aux(InIt first, InIt last, std::input_iterator_tag)
    {
       //Overwrite all elements we can from [first, last)
@@ -1925,7 +1925,7 @@
    {
       //Dispatch depending on integer/iterator
       typedef typename std::iterator_traits<InIt>::iterator_category ItCat;
- this->priv_range_insert(pos.get_ptr(), first, last, ItCat());
+ this->priv_range_insert(pos, first, last, ItCat());
    }
 
    void priv_check_range(size_type n) const


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk