Kompilatorfel C3206

"function" : ogiltigt typargument för "param", argumentlista av typen saknas i klasstypen "typename"

Anmärkningar

En funktionsmall definieras som att ta ett argument av malltyp. Dock angavs ett template template-argument.

Examples

I följande exempel genereras C3206:

// C3206.cpp
template <class T>
void f() {}

template <class T>
struct S {};

void f1() {
   f<S>();   // C3206
   // try the following line instead
   // f<S<int> >();
}

Möjlig lösning:

// C3206b.cpp
// compile with: /c
template <class T>
void f() {}

template <class T>
struct S {};

void f1() {
   f<S<int> >();
}

C3206 kan också inträffa när du använder generiska läkemedel:

// C3206c.cpp
// compile with: /clr
generic <class GT1>
void gf() {}

generic <class T>
value struct GS {};

int main() {
   gf<GS>();   // C3206
}

Möjlig lösning:

// C3206d.cpp
// compile with: /clr
generic <class GT1>
void gf() {}

generic <class T>
value struct GS {};

int main() {
   gf<GS<int> >();
}

En klassmall tillåts inte som ett malltypargument. I följande exempel genereras C3206:

// C3206e.cpp
template <class T>
struct S {};

template <class T>
void func() {   // takes a type
   T<int> t;
}

int main() {
   func<S>();   // C3206 S is not a type.
}

Möjlig lösning:

// C3206f.cpp
template <class T>
struct S {};

template <class T>
void func() {   // takes a type
   T t;
}

int main() {
   func<S<int> >();
}

Om det behövs en mallmallsparameter måste du omsluta funktionen i en mallklass som tar en mallmallparameter:

// C3206g.cpp
template <class T>
struct S {};

template<template<class> class TT>
struct X {
   static void func() {
      TT<int> t1;
      TT<char> t2;
   }
};

int main() {
   X<S>::func();
}