Home » Community » Coffee corner » About Nuller and Null
About Nuller and Null [message #55090] |
Sat, 10 October 2020 10:58 |
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
|
|
|
Goto Forum:
Current Time: Wed Apr 24 06:09:02 CEST 2024
Total time taken to generate the page: 0.03935 seconds
|