Boost logo

Boost :

Subject: [boost] [foreach][assign] Does foreach work with assign::list_of?
From: MaximYanchenko (MaximYanchenko_at_[hidden])
Date: 2011-06-12 07:34:43


This simple example doesn't compile with GCC 4.4 + Boost 1.46.1:

#include <boost/assign/list_of.hpp>
#include <boost/foreach.hpp>
#include <iostream>

int main()
{
  BOOST_FOREACH( int i, boost::assign::list_of(3)(1)(4)(1)(5) )
    std::cout << i << ' ';
}

error: operands to ?: have different types 'const
boost::foreach_detail_::rvalue_probe<boost::assign_detail::generic_list<int> >'
and 'boost::assign_detail::generic_list<int>'

I believe both Foreach and Assign library are to ease sequence
creation/iteration on the fly, so they should work together smoothly.

Thanks,
Maxim


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk