25.12.2015 17:13, Ur@nuz пишет:
static struct LogerInfo
{
string func;
int line;
void write(T...)(T data)
{
import std.stdio;
import std.algorithm: splitter;
import std.range: retro;
import std.range: take;
import std.array: array;
string shortFuncName =
func.splitter(".").retro.take(2).retro.array;
writeln( shortFuncName, "[", line, "]: ", data );
}
}
You can do following http://dpaste.dzfl.pl/41c57f89a5a0
The reason of compile error is your using a range as a separator, change
it to single symbol and it works. Also I used 'array' after 'take' to
make range bidirectional to let next 'retro' works. And 'join' joins
result to string with '.' as a separator.