See,I have this code:
template<typename T=int>struct color
{
T red, green, blue;
color(T r, T g, T b)
:red(r), green(g), blue(b)
{
}
#ifdef SDL_BACKEND
template<typename R,typename S> R map(S surf)
{
return SDL_MapRGB(surf->format,red,green,blue);
}
#endif /* SDL_BACKEND */
};
and I use it here:
pro::color<int> black(0,0,0);
SDL_FillRect(screen, 0, black.map(screen));
Now here's the error I'm getting:
error: no matching function for call to 'pro::color::map(SDL_Surface*&)'|
I'm not that experienced in templates, so I haven't seen this error before. What exactly is the problem?
NOTE: I didn't tag this with the "SDL" tag, because IMHO this question is more related to templates , the fact that I am using SDL is irrelevant. Also I'm using gcc-4.4x with -std=c++0x.