U++ framework
Do not panic. Ask here before giving up.

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: 1319
Registered: March 2007
Ultimate 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: Tue Jul 21 09:55:10 GMT+2 2026

Total time taken to generate the page: 0.00505 seconds