C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

forward declaration of templated functions in a templated cl

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
ThosRTanner
Guest





PostPosted: Wed Jan 26, 2005 6:48 pm    Post subject: forward declaration of templated functions in a templated cl Reply with quote



How do I do it? Or to be more specific, someone wrote this code:

template <class X> class Wibble
{
public:
template <class Y> void update(const Y&);

};

template <class X> template <class Y>
inline void Wibble<X>::update<Y>(const Y&y )
{
//blah
}

The compiler we are currently using allows all sorts of abuse to C++,
and lets this through quite happily. However, no other compiler we have
found permits this, and we are trying to port the code to another
system.

I know we could inline the code, but there's a coding standard that we
shouldn't do this, so I'd prefer not to if possible.

Thanks


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Efrat Regev
Guest





PostPosted: Wed Jan 26, 2005 8:52 pm    Post subject: Re: forward declaration of templated functions in a template Reply with quote




"ThosRTanner" <ttanner2 (AT) bloomberg (DOT) net> wrote

Quote:
How do I do it? Or to be more specific, someone wrote this code:

template <class X> class Wibble
{
public:
template <class Y> void update(const Y&);

};

template <class X> template <class Y
inline void Wibble {
//blah
}

The compiler we are currently using allows all sorts of abuse to C++,
and lets this through quite happily. However, no other compiler we have
found permits this, and we are trying to port the code to another
system.

I know we could inline the code, but there's a coding standard that we
shouldn't do this, so I'd prefer not to if possible.

Thanks




template <class X> class Wibble
{
public:
template <class Y>
void update(const Y&);

};


template <class X>
template <class Y>
// Previously the following line was inline void Wibble<X>::update<Y>(const
Y&y )
void Wibble<X>::update(const Y&y )
{
//blah
}



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Hyman Rosen
Guest





PostPosted: Wed Jan 26, 2005 8:53 pm    Post subject: Re: forward declaration of templated functions in a template Reply with quote



ThosRTanner wrote:
Quote:
How do I do it?

Like this:

template <class X> template <class Y>
inline void Wibble<X>::update(const Y&y )
{
//blah
}

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.