fusion::map_tieして名前(タグ)を付ける。
#include <boost/fusion/include/at_c.hpp> #include <boost/fusion/include/map_tie.hpp> #include <boost/fusion/include/at_key.hpp> #include <iostream> #include <boost/fusion/include/make_vector.hpp> namespace fusion = boost::fusion; struct id {}; struct name {}; template <class AssocSeq> void foo_impl(const AssocSeq& seq) { std::cout << "id:" << fusion::at_key<id>(seq) << " name:" << fusion::at_key<name>(seq) << std::endl; } template <class Seq> void foo(const Seq& seq) { foo_impl(fusion::map_tie<id, name>( fusion::at_c<0>(seq), fusion::at_c<1>(seq))); } int main() { foo(fusion::make_vector(1, "Akira")); }
id:1 name:Akira