|
From: Kakhkhor A. <kab...@gm...> - 2010-08-10 00:48:47
|
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.
|