On July 31, 2015 6:01:04 AM EDT, dariomt@gmail.com wrote:
Hi all,
Say I have a compile-time map of
pairs, and I need to access the correct element given a value at runtime and do something with that type. That something would be the same for any of the mapped types (e.g. calling an overloaded function that would then do the right thing depending on the type). The value would typically be an enum.
Is there anything in the Boost libraries to help with this?
If I used C++11, would there be a simple solution to this?
Not really a boost question, perhaps. First, I'm not sure why anyone wouldn't leverage at least C++11+. Especially considering compiler advancements in recent history. Optimization technology being what it is and all. That said, if it was me, I might have a look at a std::function (or boost::function) "type factory" that knew how to interface with an instance repository. Could be a functor instance, as well, for that matter.
Regards
Cheers.
PS: I cannot use Boost.Variant
Why not?
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.