Merge pull request #544 from 9rnsr/fix7878

Issue 7878 - A problem with purity and general templated algorithms
This commit is contained in:
Jonathan M Davis 2012-06-04 01:36:51 -07:00
commit 8e37bf3d01
2 changed files with 11 additions and 105 deletions

View file

@ -6977,7 +6977,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))))