Boost logo

Boost Users :

Subject: [Boost-users] [fusion] Are Sequence stream IO operators recursive?
From: Hugh Dickinson (hugh.dickinson_at_[hidden])
Date: 2010-11-02 06:31:11


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,
Hugh

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