Inside of a class template having parameter typename T
the compiler generates an error concerning 2 functions. T
does not seem to be recongnized as the template class parameter it was declared as.
template <class Return, class ...Args>
void executeOnAll(Return (T::*function) (Args &&...), Args &&...args)
{
for(T &s : *this)
(s.*function) (std::forward<Args>(args)...);
}
template <class Return, class ...Args>
void executeOnAll(Return (T::*function) (Args &&...) const, Args &&...args) const
{
for(const T &s : *this)
(s.*function) (std::forward<Args>(args)...);
}
As my array class has many other member functions, this error is specific to the 2 above.
Error Output:
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(244) : error C2825: 'T': must be a class or namespace when followed by '::'
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(750) : see reference to class template instantiation 'JAbstractArray<T>' being compiled
with
[
T=bool
]
C:\AppProjects\JS3D\Source\js3d\../jscommon/jmemory.h(218) : see reference to class template instantiation 'JArray<bool>' being compiled
C:\AppProjects\JS3D\Source\js3d\../jscommon/jmemory.h(235) : see reference to class template instantiation 'JPlacementArray<T>' being compiled
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(244) : error C2645: no qualified name for pointer to member (found ':: *')
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(244) : error C2275: 'T' : illegal use of this type as an expression
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(750) : see declaration of 'T'
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(244) : error C2143: syntax error : missing ')' before '`global namespace''
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(244) : error C2059: syntax error : ')'
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(251) : error C2825: 'T': must be a class or namespace when followed by '::'
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(251) : error C2645: no qualified name for pointer to member (found ':: *')
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(252) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(260) : error C2864: 'JAbstractArray<T>::error' : a static data member with an in-class initializer must have non-volatile const integral type
with
[
T=bool
]
type is 'const char []'
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(261) : error C2988: unrecognizable template declaration/definition
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(261) : error C2059: syntax error : '!'
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(261) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\appprojects\js3d\source\jscommon\msvc\../jarray.h(261) : fatal error C1903: unable to recover from previous error(s); stopping compilation