Subject: Re: [boost] Query of interest for a container output library
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-01-30 10:55:17
On Wed, Jan 30, 2013 at 7:27 PM, Tal Zion <talzion12_at_[hidden]> wrote:
> The library defines a templated operator<< that is enabled (by
> Boost.EnableIf) for all types that have a const_iterator typedef, or
> evaluate to true in boost::fusion::is_sequence<T> and are not already
> boost::iterator_range already defines operator<< and so the library will
> "back down" and let iterator_range do its job. The library tries not to
> interfere with other objects. If another object says it can be outputted to
> an ostream, the library "believes" it.
> By using this philosophy, the library prevents any ambiguity in operator<<.
> But to answer your question, the library is completely generic and it does
> support arbitrary ranges.
> Here are some code snippets that show how the library captures a range:
I'm not familiar with has_left_shift behavior but from the look of it
it seems that it checks for availability of operator<< with a
particular signature. If so, the is_ostreamable check is unreliable
because there may be a suitable operator<< to be found by ADL or
otherwise which does not match the signature.
Anyway, I feel very uncomfortable about defining such blanket
operators because it can interfere with user's code and intentions. I
would prefer the manipulator-based approach.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk