Q:

std::equal gives "Term doesnt evaluate to a function taking 2 arguments"

I want to compare the content of two files, so i used following code,
char readBuffer1[256]; char readBuffer2[256];
DWORD numOfBytesToRead = 256;
DWORD numOfBytesReadFile1, numOfBytesReadFile2;

while(ReadFile(fileHandle1, readBuffer1, numOfBytesToRead, &numOfBytesReadFile1, NULL) 
   && numOfBytesReadFile1 > 0 
   && ReadFile(fileHandle2, readBuffer2, numOfBytesToRead, &numOfBytesReadFile2, NULL)  
   && numOfBytesReadFile2 > 0)
{
    if(!std::equal(readBuffer1, &readBuffer1[numOfBytesReadFile1], readBuffer2, &readBuffer2[numOfBytesReadFile2]))
        return false;
}

But when compiling the equal method gives the error "term doesnt evaluate to a function taking 2 arguments", from xutility.cpp line 3073. 
If any one can please tell the reason for this error?
thanks

A:

See the reference
You're trying to use the overload std::equal which takes 4 iterators, which only exists in C++14. It doesn't exist in older versions, hence the confusing error because of using the "3 iterators and a predicate" overload - std::equal tries to use the &readBuffer2[numOfBytesReadFile2] as a predicate.
You can either enable C++14 mode, or try to use the overload with 3 iterators, with checking if the byte count is different beforehand.

