|
Boost : |
From: Frank Laub (frank.laub_at_[hidden])
Date: 2005-12-07 17:01:37
*OK, here's my first pass of the code:
On 12/7/05, Larry Evans <cppljevans_at_[hidden]> wrote:
>
> On 12/07/2005 05:47 AM, Frank Laub wrote:
> > Hello fellow boosters,
> >
> > I've recently come up with a way to use the boost preprocesor to
> generate a
> > 'better' enum type. The following is an example of some typical
> usage. Is
> > anyone else interested in this sort of thing? I'm hoping to get
> suggestions
>
> I'm interested.
>
> > for how to make it more 'boost-like' in both its implementation and its
> > usage. Is this very readable? Is there a place I can upload the code
> for
> > people to peruse?
>
> The boost file vault:
>
> http://boost-consulting.com/vault/
>
> under the 'Preprocessor Metaprogramming' directory.
> >
> > #include <iostream>
> > #include <boost/enum.hpp>
> > #include <boost/foreach.hpp>
> > #define foreach BOOST_FOREACH
> >
> > BOOST_ENUM(Level,
> > (Abort)("unrecoverable problem")
> > (Error)("recoverable problem")
> > (Alert)("unexpected behavior")
> > (Info)("expected behavior")
> > (Trace)("normal flow of execution")
> > (Debug)("detailed object state listings")
> > )
> >
> > int main()
> > {
> > foreach(const string& name, Level::names)
> > {
> > cout << name << endl;
> > }
> [snip]
> Tha above looks great, and I remember, several weeks or months
> ago, there was a request for just such a utility on
> comp.lang.c++.moderated.
>
> Thanks.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk