lundi 20 juillet 2015

Candidate template ignored: substitution failure

I have a problem of substitution failure, and answers of some similar questions do not help me.

Here is the main part:

template<int dim, int loop>
class Partition{
    // ...
public:
    // ...
    template<int r, int c> using matrix = int[r][c];
    template<int r, int c> readPattern(const matrix<r,c> &pattern)
    {
       // ...
    }
    // ...
};

And I call this template function like:

// ... 
const int DENOISE_UR[3][4] = {/*...*/};
Partition partition;
partition.readPattern(DENOISE_UR);
// ...

When using clang++(linux) to compile, it resulted in the following compiling error:

 error: no matching function for call to 'readPattern'
   note: candidate template ignored: substitution failure[ with r = 3, c = 4 ]
         template<int r, int c> void readPattern(const matrix<r,c> &pattern)

Why?

What's weird is that the codes above did compile and work on Visual Studio 2013.

Aucun commentaire:

Enregistrer un commentaire