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

Home » U++ Library support » U++ Core » The problem with 'Null'
Re: The problem with 'Null' [message #20449 is a reply to message #20446] Thu, 19 March 2009 08:42 Go to previous messageGo to previous message
gridem is currently offline  gridem
Messages: 45
Registered: August 2008
Member
I found a dirty trick:
template<typename T>
struct PickedVector : Vector<T>
{
	PickedVector()
	{
		Vector<T>() = *this;
	}
};

template<typename T>
const Vector<T>& VectorNull()
{
	return Single<PickedVector<T> >();
}

template<typename T>
bool IsNull(const Vector<T>& v)
{
	return v.IsPicked();
}

Cout() << "Is Null: " << IsNull(Vector<int>()) << EOL;
Cout() << "Is Null: " << IsNull(VectorNull<int>()) << EOL;

output:
Is Null: false
Is Null: true

and picked state may be treated as Null.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: In some cases CParser can be out of buffer
Next Topic: Possible bug/clarification only callback2 was changed for const Object*
Goto Forum:
  


Current Time: Thu Sep 10 16:01:18 GMT+2 2026

Total time taken to generate the page: 0.01032 seconds