|
Boost Users : |
Subject: Re: [Boost-users] Hierarchical enumeration?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-09-21 10:22:54
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net