splitter, compilation issue

sigod via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 27 13:58:56 PDT 2015


Here's simple code:

	import std.algorithm;
	import std.array;
	import std.file;
	
	void main(string[] args)
	{
		auto t = args[1].readText()
			.splitter('\n')
			.filter!(e => e.length)
			.split("---")
		;
	}

Looks like it should work, but it won't compile. DMD 2.068.2 
fails with this error:

	Error: template std.algorithm.iteration.splitter cannot deduce 
function from argument types !()(FilterResult!(__lambda2, 
Result), string), candidates are:
	...
	Error: template instance 
std.array.split!(FilterResult!(__lambda2, Result), string) error 
instantiating

It compiles if I insert `.array` before `.split(...`.

Am I missing something? Or it's a bug? I've tried to make a brief 
search in the bug tracker, but didn't found anything.

P.S. dpaste gives very strange error:

	/d712/f815.d(8): Error: unterminated character constant
	/d712/f815.d(9): Error: unterminated character constant
	... and so on



More information about the Digitalmars-d-learn mailing list