$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Torsten Sadowski (tsadowski_at_[hidden])
Date: 2008-05-06 07:35:47
Hi,
I have a bug when using set_difference with lists which puzzles me.
The code runs like this:
list<int> nids,gnids,rnids;
//fill nids and gnids
nids.sort();
gnids.sort();
set_difference(nids.begin(), nids.end(),
gnids.begin(), gnids.end(),
rnids.begin());
It works as expected in debug mode (-O0) but crashes in optimized
mode (-O3). rnids is still empty after set_difference and the program
crashes as soon as I try to use rnids. If I use a vector of the right
size for rnids everything works. Obviously the memory allocation for
the receiving list is optimized away. Is this not against the idea of
the STL algorithms?
Cheers, Torsten