Bonjour à tous.
J'ai déclaré un opérateur comme ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
template<typename Type, unsigned int L, unsigned int C, bool Static>
bool operator!=(const typename Matrix<Type,L,C,Static>::const_iterator& first, const typename Matrix<Type,L,C,Static>::const_iterator& second);
Et dans le main :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include "Matrix.hpp"
 
typedef Matrix<float, 4,4, true> Mat;
 
int main()
{
    Mat m;
    Mat::const_iterator it=m.begin();
    Mat::const_iterator it2=m.end();
    bool t= it!=it2);
    return 0;
}
Et j'obtiens :

error: no match for 'operator!=' in 'it != it2'

Je ne comprends pas pourquoi il n'appelle pas ma fonction template.
Cependant, ceci marche :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
bool operator!=(const Matrix<float,4,4,true>::const_iterator& first, const Matrix<float,4,4,true>::const_iterator& second);
Quelqu'un sait-il pourquoi ma fonction ne marche pas ?

Je compile avec Mingwgcc4.5 avec -std=c++0x, -pedantic-errors -Wall ...

Merci à tous.