I already asked about this on the mailing list, but I was not so clear because of my intentions. It may also be I do not quite understand how I can do this.
I want to combine several cards in hana, see the following code example:
constexpr auto m1 = hana::make_map(
hana::make_pair("key1"_s, hana::type_c<std::string>),
hana::make_pair("key2"_s, hana::type_c<std::string>)
);
constexpr auto m2 = hana::make_map(
hana::make_pair("key3"_s, hana::type_c<std::string>),
hana::make_pair("key4"_s, hana::type_c<std::string>),
hana::make_pair("key5"_s, hana::type_c<std::string>)
);
constexpr auto m3 = hana::make_map(
hana::make_pair("key6"_s, hana::type_c<std::string>),
hana::make_pair("key7"_s, hana::type_c<std::string>),
hana::make_pair("key8"_s, hana::type_c<std::string>)
);
I already got an answer on how to do this for two cards:
constexpr auto result = hana::fold_left(m1, m2, hana::insert);
constexpr auto expected = hana::make_map(
hana::make_pair("key1"_s, hana::type_c<std::string>),
hana::make_pair("key2"_s, hana::type_c<std::string>),
hana::make_pair("key3"_s, hana::type_c<std::string>),
hana::make_pair("key4"_s, hana::type_c<std::string>),
hana::make_pair("key5"_s, hana::type_c<std::string>)
);
When I checked the documentation, I see that fold_left takes 2 or 3 arguments.
Looks like I need something like: fold_left (fold_left (m1, m3, hana :: insert), m2, hana :: insert);
template<typename Map...>
constexpr auto merge_multiple_maps(Map... args) {
}
But I'm not sure how to proceed from here, and I still do not have much experience in the metaprogram ...
Regards, Matthijs