There are two standard containers, when inserting elements into which links do not break (set and list). How to link them to a map so that a link to an element of one container receives a link to another? I use links in order not to allocate again the memory for the elements of both containers + iterators are broken when rehashing according to the documentation. This is what I tried, but does not want to compile:
#include <unordered_set> #include <unordered_map> #include <forward_list> #include <string> #include <functional> int main(){ std::unordered_set<std::string> A; std::forward_list<std::string> B; std::unordered_map<std::reference_wrapper<decltype(A)::value_type>, std::reference_wrapper<decltype(B)::value_type>> AB_linked; }