 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ThosRTanner Guest
|
Posted: Wed Jan 26, 2005 6:48 pm Post subject: forward declaration of templated functions in a templated cl |
|
|
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
|
Posted: Wed Jan 26, 2005 8:52 pm Post subject: Re: forward declaration of templated functions in a template |
|
|
"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
|
Posted: Wed Jan 26, 2005 8:53 pm Post subject: Re: forward declaration of templated functions in a template |
|
|
ThosRTanner wrote:
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 |
|
 |
|
|
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
|
|