What does the line:
template<typename _Tp1, typename _Seq1>
friend bool
operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);
in http://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a01367.html
do?
Why is _Tp1 repeated twice in arguements list?
Thanks,
It declares the equality operator between two
stacks a friend function of this class, which is necessary for it to access private members.The
const stack<_Tp1, _Seq1>appear twice because there are 2 arguments.Of course it can be written as
but the C++ standard (§[stack.ops] (23.3.5.3.4)) seems to require this operator to be a free function.