PDA

View Full Version : specialized templates in cpp


StOoZ
March 24th, 2008, 05:18 PM
im reading a book (C++), and I still cant understand what is so special about specialization in templates, I would be very happy if someone can explain it in short... :(

10x

heikaman
March 24th, 2008, 11:53 PM
in short, templates are generic which means they can handle different types with the same code, but sometimes you want to treat a certain type in a special way, that's what specialization is.
it's like saying “this function will handle all types except integers (specialization) I want to handle them with another function”.
that's all :)