Bir ikame hatası problemim var ve bazı benzer soruların cevapları bana yardım etmiyor. İşte Aday şablon göz ardı: ikame hatası (clang ile hata ama g ++ değil)
kodudur: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)
{
// ...
}
// ...
};
Ve şöyle bu şablon işlevi çağırmak: g ++ kullanarak
int main()
{
// ...
const int DENOISE_UR[3][4] = {/*...*/};
Partition<1,2> partition;
partition.readPattern(DENOISE_UR);
// ...
}
, bu derler.
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)
Neden: (clang++ -std=c++11 xxx.cpp
) derlemeye ++ (linux) clang kullanırken
, aşağıdaki derleme hata ile sonuçlandı?
oO, (http [derler]: // melpon.org/wandbox/permlink/xx2K1gu0J4PFutiP) ... – Columbo
@ Colombo Tam olarak sorunun ne olduğunu. 'Partition' sınıfındaki 'Reference' sınıfını kullanmam gerekiyor – Shindou
@Columbo İlk takma adı şablonunu "long [r] [c]" olarak değiştirin: http://melpon.org/wandbox/permlink/0DHbcs3C0dm9H3gX ò.Ó – dyp