I’ve searched for this question and I can’t find anything on it. Is there a better way to query something like this in Google or can anyone provide a link or links or a fairly detailed explanation? Thanks!
EDIT: Here’s an example
template< typename T, size_t N>
struct Vector {
public:
Vector() {
this->template operator=(0);
}
// ...
template< typename U >
typename boost::enable_if< boost::is_convertible< U, T >, Vector& >::type operator=(Vector< U, N > const & other) {
typename Vector< U, N >::ConstIterator j = other.begin();
for (Iterator i = begin(); i != end(); ++i, ++j)
(*i) = (*j);
return *this;
}
};
This example is from the ndarray project on Google Code and is not my own code.
Here is an example where
this->templateis required. It doesn’t really match the OP’s example though:In this example the
thisis needed because otherwiseallocwould not be looked up in the base class because the base class is dependent on the template parameterT. Thetemplateis needed because otherwise the “<” which is intended to open the template parameter list containing 200, would otherwise indicate a less-than sign ([temp.names]/4).