|
From: DU V. DE V. F. G. P. <fra...@ca...> - 2007-05-18 13:01:04
|
>As for QL_NULL_REAL, it doesn't really matter what value is used as =
long as >it's a determined one
Since it is now used as some kind of unitialized value by the quotes =
classes, I would say that it is no longer such an immaterial detail. For =
example if we can encounter the following problem:
SimpleQuote quote;
Real value =3D (std::numeric_limits<float>::max)(); //limit case test
Quote.setValue(value);
//a few lines of code later ... bug !!!!
>Speaking of which, funny that you came out with a question on Null. =
Just
>yesterday I was thinking of removing it and using boost::optional when =
a
>number might or might not be defined. What do you think?
Maybe you have thought about boost::optional for the same reason. ;-)=20
It would be cleaner indeed. However I'm not convinced that it's a good =
solution yet.
IMO boost::optional a pefect solution in the case of a free function =
which can return invalid result even in normal situations. (like the =
second example of boost optional tutorial).
On the hand it seems to me that using it for a function member would add =
some spurious trickyness to the class. What do you think of this =
implementation ?=20
Quote():isValid_(false){}
virtual void resetQuote() {
isValid_ =3D false;
}
virtual bool isValid() const {
return isValid_;
};
private:
bool isValid_;
regards,
Fran=E7ois
|