Boost logo

Boost :

From: Roman Yakovenko (romany_at_[hidden])
Date: 2002-08-27 09:14:56


You wrote:
> -----Original Message-----
> From: spamjunk_at_[hidden] [mailto:spamjunk_at_[hidden]]
> Sent: Tuesday, August 27, 2002 2:47 PM
> To: boost_at_[hidden]
> Subject: RE: [boost] discrete_set class
>
>
> Ok, this is my fault. As Joel has pointed out, I neglected to provide
> documentation. I apologize and will upload some as soon as I
> can. For now, the
> problem with your examples is the class expects the values of
> the elements to be
> in the range [LO, HI]. You are trying to use values outside
> the range. My
> understanding of C++ is that it is undefined behavior to
> convert an int to an
> enum when it is outside the enum's range.

I agree with you. But explain me smth, please.
In database table I keep integers( numeric) values.
I have to construct my objects from table record.
I have to test whether value from database is valid enum or not.
I build discrete_set that contains all enums. (They don't have to be sequential, very important to me).
And now I am going to test using contain function. At first I must use static_cast to convert
value to enum(I don't like it) and then I have to test.
What is wrong with this scenario. And if your class doesn't give a solution for this
problem, than what problem you are trying to solve?

> pop-server.stny.rr.com
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

Roman


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