views:

59

answers:

3

while going through some of the mili source code I came across a struct declared like this:

template <class T, class Pre, class Pos>
struct PrePosCaller<T*, Pre, Pos>

(from here)

The part I'm unfamiliar with is <T*, Pre, Pos>. I understand what the code does and its purpose in this context but I would like to know where it is documented so I can learn/understand it a bit more.

+2  A: 

That is a template specialization. In particular a partial specialization.

Somewhere in the code there is a template declared as:

template <class T, class Pre, class Pos>
struct PrePosCaller { //...
};

or something similar. Then they are providing an specialization of that template for the cases where the first argument is a pointer type. That is, this is a template definition for PrePosCaller when the first argument of the template is a pointer.

David Rodríguez - dribeas
+1- now I know what it is called.
João Portela
+3  A: 

I would like to know where it is documented

If you are looking for an introduction as well as background to the subject, get yourself a copy of C++ Templates: The Complete Guide.
While the definitive documentation is the C++ standard itself, its no fun to approach it without a well written overview.

Georg Fritzsche
+1  A: 

Thinking in C++ Vol. 2 provides a pedagogical view on templates and some related techniques. It is also an excellent read about C++ in general. And it is free.

Alexandre C.
the link is broken.
João Portela
sorry, fixed it.
Alexandre C.