How to convert this code: (is(ToString(t))

Pablo via Digitalmars-d digitalmars-d at puremagic.com
Sun May 8 11:55:58 PDT 2016


This is part of the old dparse.d file:

private import std.string : ToString = toString ;

	char[] string()
	{
		static if(str)
		{
			static if(is(T == char[]))
				return t;
			else static if(is(ToString(t)))
				return ToString(t);
			else
				return "<<"~T.stringof~">>";
		}
		else
			return "<<"~T.stringof~">>";
	}

I have a problem with this part:  (is(ToString(t)) :
dparse.d(215): Error: function declaration without return type. 
(Note that constructors are always named 'this')

How to fix this code?

Regards
Pawel



More information about the Digitalmars-d mailing list