Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] maps and arrays
From: Seeger, Steven D. (GSFC-444.0)[Embedded Flight Systems, Inc] (steven.seeger_at_[hidden])
Date: 2014-06-29 09:52:42


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<short, > int, > std::array<int, 2>, // 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<int, 2> as: test_1 test{1,2, {{3,4}}, {"hello"}}; Now with 1.55 it's only working with: test_1 test{1,2,std::int<array, 2>{3, 4}, "hello"}; //missing braces on string correct I'm using both gcc 4.8.3 and clang 3.4.1. Steven


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