From: Agust?n K-ballo Berg? Subject: Re: [Boost-users] [fusion] maps and arrays
Not an official answer in any way, but considering it's not explicitly documented as supported and your test case also fails when replacing `fusion::map` with `std::tuple` I would consider it just a fluke in the past. On the other hand, the following code compiles correctly (albeit with possibly a warning):
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.
typedef std::tuple
, // note std::array std::string > test_t;
You inspired me with your use of std::array to try it out in my example. I changed "print_me" to use t.second instead of just t (which is correct) and then made a template function to support std::array with std::cout. That did the trick. Of course, the real goal here would be to handle it on the for_each side not the cout side, as outputting the types is not always the goal.
test_t test{1, 2, {}, {"hello"}};
You know one other weird thing, is that with boost 1.53 I could initialize this with std::array