0

Why C++ has this restriction, in other words, if template function could also be partially-specialized, does it lead to any ambiguity or implementation complexity?

Why it cannot act like template class?

Laurel
  • 5,965
  • 14
  • 31
  • 57
Troskyvs
  • 7,537
  • 7
  • 47
  • 115
  • 3
    in short because overload resolution rules would become more complicated than they already are... as far as i understand. this is surely a duplicate question. you could read this: http://www.gotw.ca/publications/mill17.htm – Chris Beck Jun 27 '16 at 04:39
  • Because the standard says that. – skypjack Jun 27 '16 at 05:16

1 Answers1

1

I believe the idea was that you can cover most of the cases by overloading function templates (something you can't do with classes) and the designer probably thought that the remaining cases were not worth the additional complications in overload resolution.

MikeMB
  • 20,029
  • 9
  • 57
  • 102