jeudi 27 avril 2017

std::array, operator overload not working with Intel Compiler 15.0 on linux

In my current project, I overloaded the std::array operators. Here an example of the minus :

template <class T, int N>
std::array<T, N> operator-(std::array<T, N>& arr1, std::array<T, N>& arr2) {
    std::array<T, N> dst;
    for ( auto itArr1 = arr1.begin(), itArr2 = arr2.begin(), itDst = dst.begin(); itArr1 != arr1.end(); ++itArr1, ++itArr2, ++itDst )
        *itDst = *itArr1 - *itArr2;
    return dst;
}

When compiling my project with VS 2013 and using Intel compiler 15.0, there is no problem, and the operator works fine.

But when I'm on linux with Intel compiler 15.0, I got the following error when calling the operator between two std::array :

error: no operator "-" matches these operands  
operand types are: std::array<int, 2UL> - std::array<int, 2UL>
          auto result = arr1 - arr2;

Is there something special that I have to perform ?

Aucun commentaire:

Enregistrer un commentaire