Request Indentifier::null


#1

Hi Jules, small request here. Would it be possible add a static Identifier::null similar to var::null or ValueTree::invalid so we have a consistant way to check for invalid Identifiers.

I have quite a lot of methods which return my Identifiers based on an enum and need a way to return something for the default statement. As I’m returning by reference I can’t just create a new Identifier with the default constructor.

Cheers.


#2

I could add that, but you should be returning Identifiers by value, not reference. They’re only a wrapper around a pointer, so copying them is effectively free.


#3

True but I still think its more descriptive and explicit to be able to write code like:

[code]if (returnedIdentifier != Indentifier::null)

or

if (! returnedIdentifier.isNull())[/code]

over this:


#4

Yes, I agree, and I’ll add that. Just wanted to make the point that copying them is ok.