Why can't I specialize on greater<> ???

See http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10297032 

In VC6 I can't specialize on the template greater<> from STL?
Read the above question history, and let me know what you think about it....

Luc
LVL 3
LucHoltkampAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
KangaRooConnect With a Mentor Commented:
So here is the answer; place the specialization in  namespace  std

namespace std {
   template<> class greater<const char*>
   {
       public: bool operator()(const char* p1, const char* p2) const  {/*Your implementation*/}
    };
};
0
 
ntdragonCommented:
when you are using tamplate functions or class's
u should write before them
template<class t>

i mean if you"ll take stack.h
there is a class stack
then if i want to make a stack of int i should write:

stack<int> S;//stack of int's

and in the h file

is writen
template<class T>
class stack{
....
};

i hope i understood your question right
and answer it


0
 
KangaRooCommented:
:)
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LucHoltkampAuthor Commented:
Sorry ntdragon, but did you read the question
http://www.experts-exchange.com/jsp/qShow.jsp?ta=cplusprog&qid=10297032   ?

This is not what I asked....
0
 
KangaRooCommented:
Hi ntdragon,

This is about template (partial) specialization:

template<typename T1, typename T2>
class A
{
    // general template
};

template<typename T>
class A<T, T*>
{
   // specialization for instances where T2 has type T1*
};
0
 
LucHoltkampAuthor Commented:
Any ideas why it must be in namespace std?
Why cant I just specialize after
using namespace std....


0
All Courses

From novice to tech pro — start learning today.