Opened 15 years ago
Last modified 13 years ago
#1404 new Feature Requests
Unordered Fusion Map constructors.
Reported by: | Owned by: | Joel de Guzman | |
---|---|---|---|
Milestone: | To Be Determined | Component: | fusion |
Version: | Boost Development Trunk | Severity: | Cosmetic |
Keywords: | Cc: |
Description
Currenty, when constructing Fusion Maps, the order of type arguments used as template parameters need to be followed in the constructor as well.
Example:
struct tags { struct type_1 { }; struct type_2 { }; }; using namespace boost::fusion ; typedef map< pair<tags::type_1, int>, pair<tags::type_2, int> > my_map_type ; { // following line will not compile, because of the argument ordering my_map_type instance( make_pair<tags::type_2>(2), make_pair<tags::type_1>(1) ); // following line will compile, because the argument order is the same as // the order of elements in the fusion map specialization my_map_type instace_works( make_pair<tags::type_1>(1), make_pair<tags::type_2>(2) ); }
The feature request is to support arbitrary ordering of constructor arguments, not necessarily to follow the order of argument types as prescribed in the template arguments to the fusion map.
Note:
See TracTickets
for help on using tickets.
[Bug Sprint] One way I see of implementing this would be through a view which reorders the elements of a source map to match the order of keys of a target map. This view could then be used for construction and assignment from an existing map:
The map class could use the reordering view automatically in construction from a list of arguments, construction from a Sequence, and assignment (so that the OP's original code snippet compiles), but that would complicate the otherwise simple implementation. Would using the reordering view manually fulfill the need here?