Boost logo

Boost Users :

From: Sohail Somani (s.somani_at_[hidden])
Date: 2006-03-27 16:14:53


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of
> Tomas Puverle
> Sent: Monday, March 27, 2006 12:07 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] safe assign of int to enum
>
> > template<typename Enum>
> > typename Enum::type convert_enum(int a)
> > {
> > typedef typename Enum::type type_;
> > assert(a >= Enum::min && a <= Enum::max);
> > return type_(a);
> > }
>
> This won't work for enums where the range is not continuous.
>
> I wrote a library for "smart enums" that allow you to:

I am aware of these limitations :) I vote for post!


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