に無効な明示的に指定された引数:C++:候補テンプレート無視:私はこの機能ヘッダーを持つテンプレートパラメータ
template <
bool src_alpha,
int sbpp, int dbpp,
typename T1, typename T2,
Color (*getFunc)(T1 data, Uint8* addr),
void (*putFunc)(T2 data, Uint8* addr, Color c)
>
static void OperateOnSurfaces(T1 data1, T2 data2, SDL_Surface * bmpDest, SDL_Surface * bmpSrc, SDL_Rect& rDest, SDL_Rect& rSrc)
これは私がそれを使用する方法です:
OperateOnSurfaces<
true,
32, 32,
SDL_PixelFormat*, SDL_PixelFormat*,
GetPixel<true,32>, PutPixel<true,true,32> >(
bmpSrc->format, bmpDest->format,
bmpDest, bmpSrc, rDest, rSrc);
これはGetPixel
とPutPixel
次のとおりです。
template<bool alpha, int bpp>
static Color GetPixel(SDL_PixelFormat* format, Uint8* addr) { /* .. */ }
template<bool alpha, bool alphablend, int bpp>
static void PutPixel(SDL_PixelFormat* format, Uint8* addr, Color col) { /* .. */ }
そして、このエラーが発生します:
note: candidate template ignored: invalid explicitly-specified argument for template parameter 'getFunc' [3]
なぜですか?
どのように使用しますか? – kennytm
アンダースコアと大文字で始まる名前は予約されています。使用しないでください。また、あなたは重要な情報が欠落しています:*どのようにあなたはその関数を呼び出しますか?*どのようなパラメータ? – Xeo
二重アンダースコアを含む名前は、アンダースコアと大文字で始まる名前と同様に予約されています。 – Xeo