Template Methode nicht Inline in Template Klasse
-
Hallo, ich bin grade verwirrt, wie ging das?
template<class A> struct Foo { template<class B> Foo(B b); }; template<class A, class B> // Puff, falsch! Foo<A>::Foo(B b) { }'Foo<A>::{ctor}' : unable to match function definition to an existing declaration
Gruß
-
naja ich würde es erst mal so probieren.
template<class A> struct Foo { template<class B> Foo(B b); }; template<class A> // Puff, vielleicht richtig! Foo<A>::template<class B>Foo(B b) { }
-
Sorry...
[cpp]
template<class A>
struct Foo
{
template<class B>
Foo(B b);
};template<class A> // Puff, jetzt richtig!
template<class B>
Foo<A>::Foo(B b)
{}
-
Habs im Standard gefunden (natürlich erst nachdem ich gepostet habe...)
template<class A> template<class B> Foo<A>::Foo(B b) { }Edit: Und zu spät - Danke trotzdem für die Antwort.
Gruß