Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » 2023.1 alpha
Re: 2023.1 alpha [message #59865 is a reply to message #59864] Fri, 12 May 2023 15:09 Go to previous messageGo to previous message
Tom1
Messages: 1217
Registered: March 2007
Senior Contributor
Hi,

Would it be possible to add Null support for float?

I think below you can find pretty much what is needed in Core/Defs.h:
...
constexpr double DOUBLE_NULL    =    -std::numeric_limits<double>::infinity();
constexpr float FLOAT_NULL    =    -std::numeric_limits<float>::infinity();

class Nuller {
public:
	operator int() const                { return INT_NULL; }
	operator int64() const              { return INT64_NULL; }
	operator double() const             { return DOUBLE_NULL; }
	operator float() const              { return FLOAT_NULL; }
	operator bool() const               { return false; }

	Nuller() {}
};

extern const Nuller Null;

template <class T> void SetNull(T& x) { x = Null; }

template <class T> bool IsNull(const T& x)       { return x.IsNullInstance(); }

template<> inline bool  IsNull(const int& i)     { return i == INT_NULL; }
template<> inline bool  IsNull(const int64& i)   { return i == INT64_NULL; }
template<> inline bool  IsNull(const double& r)  { return !(std::abs(r) < std::numeric_limits<double>::infinity()); }
template<> inline bool  IsNull(const float& r)   { return !(std::abs(r) < std::numeric_limits<float>::infinity()); }
template<> inline bool  IsNull(const bool& r  )  { return false; }
...


Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: MacOS is POSIX...
Next Topic: 2023.1rc1
Goto Forum:
  


Current Time: Fri May 31 10:22:55 CEST 2024

Total time taken to generate the page: 0.00821 seconds