Boost logo

Boost Users :

Subject: [Boost-users] Map runtime value to type
From: dariomt_at_[hidden]
Date: 2015-07-31 06:01:04

Hi all,

Say I have a compile-time map of <value,type> 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?


PS: I cannot use Boost.Variant

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at