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:
http://www.smork.info/blog/index.php?entry=entry110809-105615

Kind regards,
Benjamin van den Hout



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net