NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Warning (level 1) C4802

'function': out-of-class member template definitions are not supported

The template member function for a class should be defined inside the enclosing class. The compiler implements the function definition.

The following sample generates C4802:

// Compile with /GX
#include <iostream>
class MyClass {
public:
        template<class T>
   void MyFunc(T x);
/*
   // Uncomment the following definition and delete the out-of-class
   // definition to resolve this warning.
        void MyFunc(T x) {
      std::cout << x << std::endl;
   }
*/
};


template<class T>
void MyClass::MyFunc(T x) {   // C4802
   std::cout << x << std::endl;
}

void main() {
   MyClass a;
   a.MyFunc(909);
}