21 Sep
2009
21 Sep
'09
2:22 p.m.
Archie14 a écrit :
Does boost (or any other lib in C++) have facility to support smth that resembles hierarchical enumeration? I would like to have something like the following:
enum Hierarchy { Store::Clothing = 1 Store::Electronics, Building::Residential, Building::Commercial }
... Hierarchy h = Hierarchy::Building::Commercial; ... if (h == Hierarchy::Store) { if (h == Hierarchy::Store::Clothing)
How could h be equal to different things at the same time? What you're looking for seems to be dynamic_cast.