Subject: Re: [Boost-bugs] [Boost C++ Libraries] #10133: boost 1.55 breaks fusion map arrays
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-07-05 15:58:49
#10133: boost 1.55 breaks fusion map arrays
-------------------------------+------------------------
Reporter: steven.seeger@⦠| Owner: djowel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: fusion
Version: Boost 1.55.0 | Severity: Regression
Resolution: | Keywords:
-------------------------------+------------------------
Comment (by anonymous):
After a discussion on the mailing list, it was determined that my use of
for_each is not correct. The library should not have stepped through each
item of an array in a fusion map but rather send the whole array as a type
to the function called on each value. It appears that this has been fixed
in 1.55.
I had a discussion on the mailing list with Agustin quoted below:
> Hi Agustin thanks for your reply. You are correct that what I'm doing is
not documented. In fact, it doesn't really make sense now that I look at
it. The for_each should be called on each type. If the type is an array it
doesn't make sense for a for_each to break down the array. That said,
there should be some way to specialize operator() in the functor passed to
it in order to correctly handle array types.
I missed the part where `for_each` was invoking the callable on each
element of the array, that is not how it is supposed to be. You are
right that making a recursive callable is the correct way to obtain that
behavior.
--
This suggests that in reality what I was doing before was actually the
bug, and that 1.55 has the correct behavior.
One issue that we did find, however, is that fusion maps with
std::array<T> types cannot have static initializers with 1.55.
For example,
typedef boost::fusion::map<boost::fusion::pair<struct blah, short>,
boost::fusion::pair<struct bleh, int>,
boost::fusion::pair<struct foo, std::array<int, 2>>,
boost::fusion::pair<struct bloog, std::string> > test_t;
test_t test{1,2, {{3,4}}, "test"};
This compiles with 1.53 but not 1.55. The {{3, 4}} is the issue.
Also interestingly enough, I have to put braces around "test" with 1.53
but not 1.55.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/10133#comment:1> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC