I have a problem replacing a replacement, and the answers to some of these questions do not help me.
Here is the code:
template<int dim, int loop> class Reference{ public: //... template<int r, int c> using matrix_t = int[r][c]; Reference(const matrix_t<dim, loop> &mat){} }; template<int dim, int loop> class Partition{ // ... public: // ... template<int r, int c> using matrix = int[r][c]; template<int r, int c> void readPattern(const matrix<r,c> &pattern) { // ... } // ... };
And I call this template function as follows:
int main() { // ... const int DENOISE_UR[3][4] = {/*...*/}; Partition<1,2> partition; partition.readPattern(DENOISE_UR); // ... }
Using g ++, it compiles.
When using clang ++ (linux) to compile ( clang++ -std=c++11 xxx.cpp ) this led to the following compilation 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?
c ++ c ++ 11 templates g ++ clang
Shindou
source share