retro() on a `string` creates a range of `dchar`, causing array() pains

Jakob Ovrum jakobovrum at gmail.com
Tue Apr 17 08:12:17 PDT 2012


Consider this simple function:

	private string findParameterList(string typestr)
	{
		auto strippedHead = typestr.find("(")[1 .. $];
		auto strippedTail = retro(strippedHead).find(")");

		strippedTail.popFront(); // slice off closing parenthesis

		return array(strippedTail);
	}

The type of the return expression is dstring, not string.

What is the most elegant way or correct way to solve this 
friction?

(Note: the function is used in CTFE)


More information about the Digitalmars-d-learn mailing list