defining "in" What is the proper way in D2?

Charles Hixson charleshixsn at earthlink.net
Sun Sep 11 13:02:37 PDT 2011


What is the proper way to define the "in" operation in D2?  I can't 
figure it out from 
http://www.digitalmars.com/d/2.0/operatoroverloading.html#Binary , and 
the source code doesn't seem to have any examples.

My current (untested) find method is:
bool	find (Key k, Node!(Key, Data) t)
{	if	(level == 0)	return	false;
	if	(k < t.key)	return	find (k, t.left);
	if (t.key < k)	return	find (k, t.right);
	return	true;
}

but I'd really rather have it be an "in" method.


More information about the Digitalmars-d-learn mailing list