[Boost-bugs] [Boost C++ Libraries] #7269: vector::insert inserts in reverse order

Subject: [Boost-bugs] [Boost C++ Libraries] #7269: vector::insert inserts in reverse order
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-08-23 15:14:56


#7269: vector::insert inserts in reverse order
-------------------------------------------------------+--------------------
 Reporter: Yechezkel Mett <ymett.on.boost@…> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.50.0 | Severity: Problem
 Keywords: |
-------------------------------------------------------+--------------------
 When inserting an input range into a boost.container vector, the items are
 inserted in the reverse order, or the program crashes.

 The problem appears to be in


 {{{
    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);
       }
    }
 }}}

 where pos is not updated after each insertion.

 In the attached file, `v1` is ok, but `v2` is reversed. If `v2.reserve(5)`
 is removed, the program crashes.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7269>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC