|
Boost Users : |
Subject: Re: [Boost-users] [fusion] Are Sequence stream IO operators recursive?
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-11-02 15:05:47
On Tue, Nov 2, 2010 at 4:31 AM, Hugh Dickinson
<hugh.dickinson_at_[hidden]> wrote:
> I'm trying to output an adapted fusion sequence (PMT::QE::DataSet<PMT::QE::Measurement>) containing other adapted fusion sequences to std::cout. I had hoped for recursive behaviour, such that the contents of each sub-sequence are printed in turn. Having looked at the code in $BOOST_ROOT/boost/fusion/sequence/io/detail/out.hpp it looks like:
>
> ----
> PMT::QE::DataSet<PMT::QE::Measurement> output;
>
> ... Fill output ...
>
> std::cout << output << std::endl;
> ----
>
> should work. Unfortunately, I'm getting compilation errors like:
>
> no match for âoperator<<â in âos << boost::fusion::operator* [with Iterator = boost::fusion::basic_iterator<boost::fusion::struct_iterator_tag, boost::fusion::assoc_struct_category, const PMT::QE::DataSet<PMT::QE::Measurement>, 0>](((const boost::fusion::iterator_base<boost::fusion::basic_iterator<boost::fusion::struct_iterator_tag, boost::fusion::assoc_struct_category, const PMT::QE::DataSet<PMT::QE::Measurement>, 0> >&)((const boost::fusion::iterator_base<boost::fusion::basic_iterator<boost::fusion::struct_iterator_tag, boost::fusion::assoc_struct_category, const PMT::QE::DataSet<PMT::QE::Measurement>, 0> >*)((const boost::fusion::basic_iterator<boost::fusion::struct_iterator_tag, boost::fusion::assoc_struct_category, const PMT::QE::DataSet<PMT::QE::Measurement>, 0>*)first))))â
>
> The other errors simply replace the index 0 with 1 and 2 (PMT::QE::DataSet has 3 elements). On the other hand, the following does work:
>
> ----
> PMT::QE::DataSet<PMT::QE::Measurement> output;
>
> ... Fill output ...
>
> std::cout << at_c<0>(output) << std::endl;
> std::cout << at_c<1>(output) << std::endl;
> std::cout << Â at_c<2>(output) << std::endl;
>
> ----
>
> Is this the expected behaviour? What am I missing? Is there a way to achieve the desired recursive behaviour?
>
> Many thanks,
You have included <boost/fusion/includes/io.hpp>, right? Without that
then output would generate an error like the above if output is a
fusion sequence, else it should stream out fine.
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