Can we declare enulm with flaot values

Hi all i want to know wether we can declare float in enum???
If not can we have alternative for it???

I want to to implement tag-value mechanism in my project, i m storing them in dictionary. As Tags are in float, i need them to be stored in enum,....

Thanks in advance...................
rohandreamworld wrote:
Hi all i want to know wether we can declare float in enum???

We can't.

rohandreamworld wrote:
If not can we have alternative for it???

Yes. Float constants:

1
2
3
const float F1=0.5;
const float F2=1.0;
const float F3=1.5;

rohandreamworld wrote:
I want to to implement tag-value mechanism in my project, i m storing them in dictionary.
As Tags are in float, i need them to be stored in enum,....

Use a std::map<float,value_type>

Info on std::map -> http://cplusplus.com/reference/stl/map/
Topic archived. No new replies allowed.