rdmenezes / ontl

Automatically exported from code.google.com/p/ontl
0 stars 0 forks source link

Incorrect std::vector::insert #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. std::string s("0011");
2. s.insert(0, s.begin()+s.size()-2,2); // insert(0, "11")
3. assert(s == "110011");

What is the expected output?
 s == "110011"

What do you see instead?
 s == "000011"

This fails because string contents was relocated.

Original issue reported on code.google.com by icestudent@gmail.com on 14 Nov 2009 at 7:42

GoogleCodeExporter commented 9 years ago

Original comment by ntl.supp...@gmail.com on 17 Nov 2009 at 10:31

GoogleCodeExporter commented 9 years ago
fixed in r709

I think insert__blank_space() should be re-factored to return the first 
position of
the inserted space. This allows to simplify dependent insert() overloads.

Original comment by ntl.supp...@gmail.com on 18 Nov 2009 at 7:03

GoogleCodeExporter commented 9 years ago

Original comment by ntl.supp...@gmail.com on 19 Apr 2010 at 4:59