Re: Help with strange (for me) STL problem that disappers when rebuilding all
On Apr 29, 4:47 pm, StephQ <askmeo...@mailinator.com> wrote:
I have a class Bounds with two constructors:
class Bounds
{
private:
list<Segment> upperLinearSpline; // Upper bound.
list<Segment> lowerLinearSpline; // Lower bound.
...
}
Bounds::Bounds()
{
}
Bounds::Bounds(double lo, double up)
{
lowerLinearSpline.push_back( Segment(Point(0, lo), 0, -HUGE_VAL,
HUGE_VAL) );
upperLinearSpline.push_back( Segment(Point(0, up), 0, -HUGE_VAL,
HUGE_VAL) );
}
Segment is another class with default constructor.
I have not defined destructors, copy constructor and copy assignement.
So the automatic membewise-copy should be used.
The class Bounds appears in other classes in the construtors as or/and
as reference member data like
....
private:
const Bounds& bounds;
...
Until here everything is working fine.
Now I write code for another class in which Bounds appears only in the
constructor as (not as member data) like:
UniformEnvelope::UniformEnvelope(const Bounds& bounds, .......
and what happends is that when I add the source code and header file
of this new class and compile normally the constructor
Bounds::Bounds(double lo, double up) stop working.
In debug mode I get no error/exceptio at all but I notice that the
push_back() is not working correctly. It does not report any error but
if simply fails to insert the value.
Practically, there are two things which can cause this: a header
file has been modified since the last full build, but one of the
source files which reused it was not recompiled, or you used
different options in the earlier compilations. (Note that even
such basic things as sizeof( std::list<Something> ) may change
depending on compiler options.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34