dimanche 26 novembre 2017

Type of enum value not int?

Since c++ underlying type of c++ enum should be int.

However having code

enum class Properties{ first , second }
void tmp ( int i ) {}

tmp( Properties::first )

Compiler complains about Properties::first not being int rather Properties type.

Do i really have to cast it to int in order to pass value of enum to function or is there workaround?

Thanks for help.

Aucun commentaire:

Enregistrer un commentaire