hi all,
i am reading the C++ templates complete guide, i have question on
the following statement.
We must therefore make sure the template parameters of the class
template appear in the type of any friend function defined in that
template (unless we want to prevent more than one instantiation of a
class template in a particular file, but this is rather unlikely).
Let's apply this to a variation of our previous example:
template <typename T>
class Creator {
friend void feed(Creator<T>*){ // every T generates a different
... // function ::feed()
}
};
Creator<void> one; // generates ::feed(Creator<void>*)
Creator<double> two; // generates ::feed(Creator<double>*)
In this example, every instantiation of Creator generates a different
function. Note that even though these functions are generated as part
of the instantiation of a template, the functions themselves are
ordinary functions, not instances of a template.
it's here, how can i define the feed() function ?
thanks in advance.
baumann@ pan