Boost logo

Boost :

Subject: Re: [boost] [Phoenix-3] Is Actor assignable?
From: Michel MORIN (mimomorin_at_[hidden])
Date: 2011-01-21 07:39:13


I have another question about Phoenix 3.
Is the copy assignment of Actors no-op, or does it really copy the contents?

Actor a;
Actor b = ...;
a = b; // no-op?

If it is no-op, then the second assertion in the following code
is not generally satisfied (the same code is attached in this mail):

  #include <boost/assert.hpp>
  #include <boost/iterator/transform_iterator.hpp>
  #include <boost/phoenix/core.hpp>
  #include <boost/phoenix/operator.hpp>

  template <typename Iterator>
  void test_forward_iterator(Iterator const& i)
  {
      Iterator j = i;
      BOOST_ASSERT(*j == *i); // OK

      Iterator k;
      k = i;
      BOOST_ASSERT(*k == *i); // Oops!
  }

  int main(int argc, char* argv[])
  {
      using boost::phoenix::arg_names::_1;
      int ar[3] = {};
      test_forward_iterator(boost::make_transform_iterator(ar, _1 + 5));

      return 0;
  }

So transform_iterator with Phoenix-3 Actors cannot satisfy
even the ForwardIterator requirements.

(In Phoenix 2, boost::phoenix::value<T> is not default constructible, and so
the above iterator does not satisfy the ForwardIterator requirements too.)

I wish transform_iterator with Phoenix Actors can be ForwardIterator,
BidirectionalIterator and RandomAccessIterator :)

Regards,
Michel




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