fix Issue 7878 - A problem with purity and general templated algorithms

This commit is contained in:
k-hara 2012-04-10 19:47:15 +09:00
parent 803aa7ccb0
commit e2c892fdbf
2 changed files with 10 additions and 104 deletions

View file

@ -6782,7 +6782,8 @@ sort(alias less = "a < b", SwapStrategy ss = SwapStrategy.unstable,
Range)(Range r)
{
alias binaryFun!(less) lessFun;
static if (is(typeof(lessFun(r.front, r.front)) == bool))
alias typeof(lessFun(r.front, r.front)) LessRet; // instantiate lessFun
static if (is(LessRet == bool))
{
sortImpl!(lessFun, ss)(r);
static if(is(typeof(text(r))))