
AMDG Sergei Politov wrote:
Sorry, I'm not very familiar with mpl::lambda, as far as I understand to write make_vector<boost::mpl::_> I should support mpl::lambda in make_vector. If so it is not neccessary, as soon as it is just example, and it does not belong to internal part of map_gen.
No. make_vector doesn't have to know about mpl::_. map_gen has to use mpl::apply to make lambda expressions work.
In other words it takes some fusion sequence and metafunction.
MPL sequence? There shouldn't be any runtime information associated with the key.
I meant: "fully conforming fusion sequences". As soon as it is possible to adapt mpl sequence to fusion sequence, I suggest it is better to require fusion sequence concept rather mpl sequence concept. Even runtime information is not used. It produces no overhead, but makes map_gen more flexible.
It's already pretty easy to make such a map using mpl sequences. #include <boost/fusion/container/map.hpp> #include <boost/fusion/include/convert.hpp> #include <boost/fusion/support/pair.hpp> #include <boost/fusion/adapted/mpl.hpp> #include <boost/fusion/sequence/intrinsic/at_key.hpp> #include <boost/mpl/vector.hpp> #include <boost/mpl/transform.hpp> #include <vector> using namespace boost; using namespace mpl::placeholders; typedef fusion::result_of::as_map< mpl::transform< mpl::vector<int, char, double>, fusion::pair<_, std::vector<_> > >::type
::type map_type;
int main() { map_type map; fusion::at_key<int>(map).push_back(1); fusion::at_key<char>(map).push_back(1); fusion::at_key<char>(map).push_back(1.4); fusion::at_key<int>(map).push_back(1.4); } In Christ, Steven Watanabe