I would like to use the same enum in both the client and server parts of my current (C++) project, but am unsure of the proper way to do this. I could easily just write the enu
Putting it in a header file seems reasonable, and wrapping it in a namespace can be useful too. Something i find myself doing with enums is
contents of whatevsenum.hpp:
namespace whatevs
{
enum Enum
{
FOO = 0,
BAR,
BLARGH,
MEH,
SIZE
};
} // namespace whatevs
and then whenever i need to use it in a header/source file elsewhere:
#include "whatevsenum.hpp"
void do_something_with(whatevs::Enum value)
{
// do stuff
}
...
do_something_with(whatevs::FOO);