Range returning an array

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Tue Apr 9 15:50:54 PDT 2013


On 04/10/2013 12:33 AM, Steven Schveighoffer wrote:
> Well here is another solution

I did consider something like that.  The actual one I have come to after
thinking about it is like this:

struct MySimulation(T)
{
	T[] var;
	T diff = T.max;
	T convergence;
	_bool empty = false;

	auto front() @property
	{
		return var;
	}

	bool empty() @property
	{
		return _empty;
	}

	void popFront()
	{
		if(diff < convergence)
			_empty = true;
		else
			// update var and calculate new diff
	}
}

How does this look to people?


More information about the Digitalmars-d-learn mailing list