 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Maximilian Hrabowski Guest
|
Posted: Tue Sep 16, 2003 8:42 am Post subject: template Methode in einer Klassen-Template |
|
|
Hallo allerseits,
hier ein paar Brocken aus einem Klassen-Template (auszugsweise):
template <class T> Temp
{
// Methode 1:
iterator find( const& T val );
// template-Methode 2:
template<class Comp>
iterator find_if( const& T val, Comp comp );
};
// ok das geht natürlich
template<class T>
typename Temp<T>::iterator Temp<T>::find( const T& val )
{
[...]
}
// so gehts nicht, wie muß ich das definieren und deklarieren?
template<class T,class Comp>
typename Temp<T>::iterator Temp<T>::find_if( const T& val, Comp comp )
{
[...]
}
Wie muß ich find_if deklarieren/definieren, damit´s der Compiler frisst
(und es funktioniert)
Gruß,
Maxim
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| Back to top |
|
 |
Torsten Robitzki Guest
|
Posted: Tue Sep 16, 2003 7:10 pm Post subject: Re: template Methode in einer Klassen-Template |
|
|
Maximilian Hrabowski wrote:
<...>
| Quote: | // so gehts nicht, wie muß ich das definieren und deklarieren?
template<class T,class Comp
typename Temp
{
[...]
}
Wie muß ich find_if deklarieren/definieren, damit´s der Compiler frisst
(und es funktioniert)
|
template <class Comp>
template <class T>
Templ<T>::iterator Temp<T>find_if( ....);
wäre die Deklaration, die Definition mußt Du schon selber schreiben :-)
mfg Torsten
--
de.comp.lang.iso-c++ - Moderation: mailto:voyager+mod (AT) bud (DOT) prima.de
FAQ: http://www.voyager.prima.de/cpp/ mailto:voyager+send-faq (AT) bud (DOT) prima.de
|
|
| 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
|
|