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 

Partielle Templatespezialisierung

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





PostPosted: Thu Feb 02, 2006 8:02 am    Post subject: Partielle Templatespezialisierung Reply with quote



Hallo NG,

ich verwende folgende struct für Vergleiche:

template< class T > struct Compare {
int operator () ( const T &rA, const T &rB ) const
{
return rA - rB;
}
};

Jetz bin ich bei der Spezialisierung auf folgendes Probleme gestoßen:

template< class T, class U > class Foo { /*...*/ };

Hierfür muss Compare so aussehen:
template< class T, class U > struct Compare< Foo< T, U > > { /*...*/ };

Wie sieht Compare allerdings für folgenden Fall aus?
template< class T, class U > class Foo {
public:
typedef struct Bar {
T * p;
};
};

template< class T, class U > struct Compare< typename Foo< T, U >::Bar >
liefert mir:
"template parameters T, U not used in partial specialization"

Wie muss es also korrekt formuliert werden?
Vielen Dank für eure Hilfe

Chris

--
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
Olaf Krzikalla
Guest





PostPosted: Thu Feb 02, 2006 1:02 pm    Post subject: Re: Partielle Templatespezialisierung Reply with quote



Hi,

Chris G. wrote:
Quote:
Wie sieht Compare allerdings für folgenden Fall aus?
template< class T, class U > class Foo {
public:
typedef struct Bar {
-------
T * p;
};
};

Nimm da mal das typedef raus. Dann tut es zumindest mit comeau.


MfG
Olaf Krzikalla

--
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.