Boost logo

Boost :

From: Richard Jennings (richard.jennings_at_[hidden])
Date: 2005-12-22 09:30:55


On Thu, 22 Dec 2005 11:04:57 -0000, Frank Laub <frank.laub_at_[hidden]>
wrote:

> One alternative is to do this instead:
>
> BOOST_ENUM_VALUES(BlockType_t, const char*,
> (SampleIfg)("Sample Interferogram")
> (SampleSpec)("Sample Spectrum")
> (SamplePhase)("Sample Phase")
> (RefIfg)("Reference Interferogram")
> )
>
> One principle idea of the Boost.Enum library is to hide the fact that
> integers are really doing the dirty work. I suppose in this case we could
> expose a 'raw' or 'native' method that would return the index number of
> the
> enumeration element. This could then be used for your vector index. Would
> this work for you?
>

Yes that would work for me. I took it that the spirit of BOOST_ENUM was
indeed to hide the basic type and that you should use BOOST_ENUM_VALUES
if you wanted to be sure of the value of each enumeration.

There's always a 'but', so mine is that using BOOST_ENUM_VALUES as you
suggest requires that the enumeration values start with zero. I think
that's most cases.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk