Boost logo

Boost :

Subject: Re: [boost] [type_erasure] Review started (July 18-27, 2012)
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2012-08-06 08:21:33


AMDG

On 08/06/2012 02:55 AM, Paul A. Bristow wrote:
>
> template <typename K, typename T>
> std::ostream& operator<< (std::ostream& os, std::pair<K, T>& p)
> { /*! Output a pair of values.
> \details For example: "1.23 , 3.45".
> */
> os << p.first << ", " << p.second;
> return os;
> }
>
> And I can echo the input as expected
>
> 1, 9.9000
> 2, 8.8000
>
> but when I try to use the sequence printer
>
> p2.print(std::cout, my_map);
>
> the compiler (VC10) complains the there is no operator<<
>

Yep. It can't be found by ADL unless it's
declared in namespace std, which is forbidden.
You can solve this by specializing
boost::type_erasure::ostreamable instead,

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