I have a function in my namespace ns
that helps me print STL containers. For example:
template
std::ostream& operator<
The problem as already noted is because of ADL (argument dependent lookup - often attributed to Andrew Koenig, but I believe he shouldn't get all the blame).
Even in your local context it wouldn't work in a template function where you intend to use your operator<<
.
One cheating trick is to put the operator<<
you define into namespace std
. That is verboten, but it might work in your case, but only if it is put before its usage and that might be the problem.
There might be further options, such as defining your own Set template. I experimented with
template using Set=std::set;
but couldn't get a solution that worked without the
using np::operator<<;
yuyoyuppe provided.