consider the following code:
namespace fruit { struct apple{ ... }; } namespace language{ struct english{ ... }; } I want to do something like:
std::unordered_map<std::string, ? > mymap = { {"paul", {"like", fruit::apple} }, {"jonas", {"like", language::english} } }; the key of my map is a string and the value should be such a pair <string, ? >.
What type should I give as value for my map? I think things like union or functor can be used to solve the problem, but how? thanks in advance.
std::variantorstd::anymymap, once constructed? Sounds like an XY problemstd::tuple<std::string,std::unique_ptr<fruit::apple>,std::unique_ptr<language::english>>and make eithernullptr