I know that SGI STL is as old as myself, but I still want to figure it out.
In stl_stack.h, there is some code like this:
template <class T, class Sequence = Deque<T> >
class Stack {
friend bool operator== __STL_NULL_TMPL_ARGS (const Stack&, const Stack&);
friend bool operator< __STL_NULL_TMPL_ARGS (const Stack&, const Stack&);
protected:
Sequence c;
};
template <class T, class Sequence>
bool operator== (const Stack<T, Sequence>& x, const Stack<T, Sequence>& y){
return x.c == y.c;
}
template <class T, class Sequence>
bool operator< (const Stack<T, Sequence>& x, const Stack<T, Sequence>& y){
return x.c < y.c;
}
In stl_config.h, __STL_NULL_TMPL_ARGS
is defined like this:
# ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
# define __STL_TEMPLATE_NULL template<>
# else
# define __STL_TEMPLATE_NULL
# endif
but when I tried to compile it with G++ 4.9.2, the compilers said this:
In file included from stack.cpp:1:0:
stack.h:13:22: error: declaration of ‘operator==’ as non-function
friend bool operator== __STL_NULL_TMPL_ARGS (const Stack&, const Stack&);
^
stack.h:13:22: error: expected ‘;’ at end of member declaration
In file included from iterator.h:3:0,
from deque.h:6,
from stack.h:5,
from stack.cpp:1:
stl_config.h:111:31: error: expected unqualified-id before ‘<’ token
# define __STL_NULL_TMPL_ARGS <>
^
stack.h:13:25: note: in expansion of macro ‘__STL_NULL_TMPL_ARGS’
friend bool operator== __STL_NULL_TMPL_ARGS (const Stack&, const Stack&);
I don't know why the exactly same code can't compile on my computer, is this code illegal code now or something?
Thank you very much!!!