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 » Coffee corner » About Nuller and Null
About Nuller and Null [message #55090] Sat, 10 October 2020 10:58 Go to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

I failed to find much documentation about Nuller and Null. Then I just looked around the source and tried to put together a generic macro to support Nuller/Null in a class.

Could someone with deeper understanding confirm if my following NULLSUPPORT -macro covers all the relevant aspects of supporting Null for a class?

#define NULLSUPPORT(x)\
	CLASSNAME(const Nuller&){ SetNull(); }\
	void SetNull(){ x=Null; }\
	bool IsNullInstance() const { return IsNull(x); }

class A{
public:
	typedef A CLASSNAME;

	NULLSUPPORT(a);

	int a;
	int b;

	A(){
		a=0;
		b=0;
	}
};


Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Architectural and C++/Upp questions
Next Topic: Sins of the past: The very first link to UPP website in the official arstechnica article
Goto Forum:
  


Current Time: Fri Apr 19 01:16:30 CEST 2024

Total time taken to generate the page: 0.01749 seconds