• Advertisement
Sign in to follow this  

Template nightmare... [SOLVED]

This topic is 4616 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey folks, now a really problem, if someone got an idea, post, post, post... well assume i've got a class template<class X> class K { struct J { X unknown; }; inline J * test( void ); }; so far so good now the implementation... template<X> inline (typename K<X>::J) * K<X>::test( vid ) { return; }; ok, for me it seems ok but the compiler means error C2226: unexpected type ( i think i have to write K<X>::J because the struct is internal and templated, probably there is an error) please help!!! thx in advance tgar [Edited by - Thaligar on July 1, 2005 1:32:00 PM]

Share this post


Link to post
Share on other sites
Advertisement
Try:

template <class X>
inline typename K<X>::J * K<X>::test(void) {
return;
};

Share this post


Link to post
Share on other sites
template<class X>
class K
{
struct J
{
X unknown;
};

public:
inline J * test( void );
};

template<typename X>
inline typename K<X>::J* K<X>::test( void )
{
return 0;
};

int main()
{
K<int> k;
k.test();
}

Share this post


Link to post
Share on other sites
a big bow ;)

thanks, awesome fast,
only this little braces,
now i fell some kind of dump

thx to "Fruny" and "SiCrane"

greets
tgar

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement