Null class bug on x64 targets
Posted by
Kakhkhor Abdijalilov on
URL: http://quantlib.414.s1.nabble.com/Null-class-bug-on-x64-targets-tp9091.html
Null<Size> may not properly compile on x64 targets because. This
happened to me with Intel C++ compiler. Proposal to change the Null
class with something like this.
//---------------------------------------------------------------------------
#include <ql/types.hpp>
#include <limits>
#include <boost/type_traits.hpp>
typedef double Real;
template <bool>
struct IntegerNull {
static int value() {
return std::numeric_limits<int>::max();
}
};
template <>
struct IntegerNull<false> {
static Real value() {
return std::numeric_limits<Real>::max();
}
};
template <typename T>
class Null {
public:
Null() {}
operator T() const {
return T(IntegerNull<boost::is_floating_point<T>::value>::value());
}
};
//---------------------------------------------------------------------------
Even better solution would be replace it with boost::optional but I
guess Null is needed for backward compatibility.
Regards,
Kakhkhor Abdijalilov.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev