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 

template Methode in einer Klassen-Template

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German)
View previous topic :: View next topic  
Author Message
Maximilian Hrabowski
Guest





PostPosted: Tue Sep 16, 2003 8:42 am    Post subject: template Methode in einer Klassen-Template Reply with quote



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





PostPosted: Tue Sep 16, 2003 7:10 pm    Post subject: Re: template Methode in einer Klassen-Template Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ (German) 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.