www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot get frame pointer to sort

reply "Tobias Pankrath" <tobias pankrath.net> writes:
--
struct Set(alias less = "a < b", T)
{
	import std.algorithm;
	import std.functional;
	alias lessFun = binaryFun!(less);

	int[] someContents;
	this(R)(R r)
	{
		sort!(lessFun)(someContents);
	}
}

unittest {
	auto as2 = Set!((x,y) => x < y , int)([2, 1, 3]);
}
-- http://dpaste.dzfl.pl/af6cb1a8d8ab

It works, if I provide a normal function or a string lambda as 
'less'. However the code above results in the following error:

/d923/f233.d(11): Error: constructor 
f233.__unittestL15_3.Set!((x, y) => x < y, 
int).Set.__ctor!(int[]).this cannot get frame pointer to sort

What's wrong?
Feb 18 2014
parent "Stanislav Blinov" <stanislav.blinov gmail.com> writes:
On Tuesday, 18 February 2014 at 22:28:08 UTC, Tobias Pankrath 
wrote:

 What's wrong?
This looks like a bug to me, seeing as string predicate works. Although I don't get how you supply default template parameter for Set before explicit one :)
Feb 18 2014