$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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.