Reputation: 863
There is nothing wrong with static
methods of template classes having (i) templates and (ii) the class itself as a parameter, is there? Consider the class
template<class Projection>
struct FrameData {
// ...
template <bool devPtr>
static void allocate(FrameData<Projection> &data) {
// ... do allocations ...
}
}
This is declared in the header of file A
. Elsewhere in the world, I have something like
template <class Projection>
void some_method(FrameData<Projection> &m_data) {
FrameData<Projection>::allocate<true>(m_data);
}
I'm ending up with some
error: reference to overloaded function could not be resolved; did you mean to call it?
.template
magic for static
methods like the answer here?FrameData<Projection>
the problem? It isn't fully defined yet?Elsewhere in this world is technically in a source file with some explicit instantiations going on at the bottom, but I put this all in one file with the same errors. Thank you for any insight, please refrain from shaming me on non-header templates. It wasn't my choice.
Upvotes: 1
Views: 858
Reputation: 93384
Is there some sort of analagous .template magic for static methods like the answer here?
Yes.
template <class Projection>
void some_method(FrameData<Projection> &m_data) {
FrameData<Projection>::template allocate<true>(m_data);
}
Upvotes: 7