Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-07-11 14:30:58


AMDG

Robert Jones wrote:
> On Fri, Jul 11, 2008 at 7:08 PM, Steven Watanabe <watanabesj_at_[hidden]>
> wrote:
>
>
>> The overload of operator<< for std::pair is not found by Boost.Lambda.
>>
> This much I have discovered painfully by trial and error - the bit I don't
> understand
> is why!

There are two ways that functions can be found from within
a template. The first is the functions which are visible at the
point where the template is defined. Your overload of operator<<
is not declared when the Boost.Lambda stuff is included, so
it won't be found that way.

The second way is through ADL. ADL searches /only/ in namespaces
associated with the argument types. In this case only namespace std
is associated with the argument types, not the global namespace, so
operator<< can't be found that way either.

> Also, it would be very handy if you can suggest a method of
> achieving the
> effect I'm looking for.
>

There isn't a legal way. The standard forbids adding functions
to namespace std.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk