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

As the scope operator is used on typename T, I am currently assuming the bool specialization, a primitive type is the culprit although, I imagine having more instances of this error in that case.

Seems to have been the occurence of the function signature whenever T is a primitive type, which in this case, the the compiler sees bool::*function corresponding the output repeatedly stating error C2825: 'T': must be a class or namespace when followed by '::'

Making them global methods instead seems to've solved the problem for now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.