|
Boost Users : |
Subject: Re: [Boost-users] [fusion] adapted std::pair and ostream
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-07-19 19:06:14
On 7/19/2011 6:28 PM, Daniel James wrote:
> Hi
>
> The docs:
>
> http://www.boost.org/doc/libs/1_47_0/libs/fusion/doc/html/fusion/adapted/std__pair.html
>
> seem to suggest that one can pipe an adapted std::pair 'directly' to cout.
>
> I find the following though:
>
> #include <iostream>
> #include <boost/fusion/adapted.hpp> // adapt pair.
> #include <boost/fusion/sequence.hpp> // operator<<() ?
> #include <boost/fusion/container.hpp> // as_vector
>
> int main(int argc, char** argv)
> {
> std::pair<std::string, int> p("foo", 7);
>
> std::cout << p << std::endl; // does not compile although docs
> suggest it should.
> std::cout << boost::fusion::as_vector(p) << std::endl; //
> compiles and works as expected.
>
> return 0;
> }
>
> Am I missing an include? Is sending to cout without first using
> as_vector actually supported?
No, it can't compile. It will only compile if ADL pickus up the << from
boost::fusion, but it can't do that because pair is in namespace std.
Could you point me to the docs where it says it should? It's probably
a doc bug.
Regards,
-- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net