/* * Null.h * * Created on: 2012-8-23 * Author: fasiondog */ #ifndef NULL_H_ #define NULL_H_ #include #include namespace hku { /** * 提供指定给定类型的Null值 * @ingroup Common-Utilities * @ingroup DataType */ template class Null { public: Null() {} operator T() const { return T(); } }; /** * 提供int的Null值 * @ingroup Common-Utilities */ template <> class Null { public: Null() {} operator int() { return (std::numeric_limits::max)(); } }; /** * 提供unsigned int的Null值 * @ingroup Common-Utilities */ template <> class Null { public: Null() {} operator unsigned int() { return (std::numeric_limits::max)(); } }; /** * 提供long long(64位整型)的Null值 * @ingroup Common-Utilities */ template <> class Null { public: Null() {} operator long long() { return (std::numeric_limits::max)(); } }; /** * 提供unsigned long long(无符号64位整型)的Null值 * @ingroup Common-Utilities */ template <> class Null { public: Null() {} operator unsigned long long() { return (std::numeric_limits::max)(); } }; #if !defined(BOOST_MSVC) /** * 提供size_t的Null值 * @ingroup Common-Utilities */ template <> class Null { public: Null() {} operator unsigned long long() { return (std::numeric_limits::max)(); } }; #endif /** * 提供double的Null值 * @ingroup Common-Utilities */ template <> class Null { public: Null() {} operator double() { return (std::numeric_limits::max)(); } }; } /* namesapce hku */ #endif /* NULL_H_ */