Modify

Opened 5 years ago

Closed 5 years ago

#7269 closed Bugs (fixed)

vector::insert inserts in reverse order

Reported by: Yechezkel Mett <ymett.on.boost@…> Owned by: igaztanaga
Milestone: To Be Determined Component: container
Version: Boost 1.50.0 Severity: Problem
Keywords: Cc:

Description

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.

Attachments (1)

container_vector_bug.cpp (711 bytes) - added by Yechezkel Mett <ymett.on.boost@…> 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by Yechezkel Mett <ymett.on.boost@…>

comment:1 Changed 5 years ago by igaztanaga

  • Resolution set to fixed
  • Status changed from new to closed

Thanks for the report fixed in trunk at revision: 80172

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.