Kompilatorfel C2252

kan inte uttryckligen instansiera mall i det aktuella omfånget

Anmärkningar

Kompilatorn upptäckte ett problem med en explicit instansiering av en mall. Du kan till exempel inte uttryckligen instansiera en mall i en funktion.

Example

I följande exempel genereras C2252:

// C2252.cpp
class A {
public:
   template <class T>
   int getit(int i , T * it ) {
      return i;
   }
   template int A::getit<double>(int i, double * it);   // C2252
   // try the following line instead
   // template <> int A::getit<double>(int i, double * it);

};

int main() {
   // cannot explicitly instantiate in function
   template int A::getit<long>(int i, long * it);   // C2252
}