Boost logo

Boost Users :

Subject: Re: [Boost-users] Enums to/from Strings
From: Benjamin van den Hout (smork1_at_[hidden])
Date: 2011-08-09 05:25:55

Hi John,

> For the time being, I've made a function called to_string, which seems to
be a common
> choice. But what's the best way to make it automatically known to those
other features?

It's not the most pretty solution, but perhaps you could resort to the Boost
Preprocessor library to generate both the enum and the 'toString' method
for you.
Some sample code can be found here on my blog:

Kind regards,
Benjamin van den Hout

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at