which I think its the best way of doing it. And then I have to compare it with the integers which are parsed out of the data.

10-07-2008

tabstop

Why not use a std::map from int to string? The find function would seem to be exactly what you want.

10-07-2008

master5001

Shouldn't you be storing your responces into a status_type anyway? Its valid in C++ to store things to a status_type using istreams or however you are processing your HTTP requests.

10-07-2008

MarkZWEERS

If you create your enum 'status_type' , you probably want to compare a variable to the values you've defined. So you should compare that variable with your enum, that's what it is ment for.

10-07-2008

l2u

Quote:

Originally Posted by MarkZWEERS

If you create your enum 'status_type' , you probably want to compare a variable to the values you've defined. So you should compare that variable with your enum, that's what it is ment for.

So by that definition its legal and okay to compare int with enum without casting it to enum?

10-07-2008

CornedBee

It's legal, and since enums are often used simply for defining a related group of integer constants (as you are doing), all the suggestions about storing a status_type or that are just overengineering.

10-07-2008

tabstop

Quote:

Originally Posted by CornedBee

It's legal, and since enums are often used simply for defining a related group of integer constants (as you are doing), all the suggestions about storing a status_type or that are just overengineering.

You're probably right, but that's no fun. :( No, actually I was thinking you wanted to compare to all the enums or something, rather than one specific one.