Hi,

I don't know if I'm missing something but I did some tests with the popFront and popBack version:

bool isPalindrome(R)(R range)
if (isBidirectionalRange!(R))
{
        while (!range.empty){
                if (range.front != range.back) return false;
                range.popFront();
        if (range.empty) break;
        range.popBack();
        }
        return true;
}

Against the older known version (or implementation):

bool isPalindrome2(R)(R r){
    auto len = r.length;
    auto mid = len/2;
    --len;
    for(auto i=0;i<mid;++i){
        if(r[i]!=r[len-i]){
            return false;
        }
    }
    return true;
}

And in my benchmark test, the first version is 3x "slower" than the second one.

Matheus.

Reply via email to