Boost logo

Boost :

Subject: Re: [boost] [Better Enums] Interest in/feedback on C++11 enums library
From: Anton Bachin (antonbachin_at_[hidden])
Date: 2015-05-21 23:40:42

I've been keeping away because I am doing a ton of work on the library, and I
don't want to attract too much attention until the work is ready, since there
are lots of changes. But, I think I should reply, and I will also give a brief
update of the progress at the end of the message.

> I suspect this code:
> Depth depth = default_<Depth>();
> could be made to look like this:
> Depth depth = _default;
> ie all enums have a constructor that takes a default_t type. The
> constructor then calls default_<T>().
> Or something like that. And then change the names to get
> Depth depth = default_; // calls default_impl<T>();

That’s a good idea. I hadn't thought of such a constructor. I will try it out,
but I am not sure that it would belong directly in the library, if that's what
you mean. It's not clear where one should stop. Should there also be an
"invalid" constructor for projects that have such a notion? Are there other
special values we can't predict?

Perhaps this could be achieved with some kind of extension facility. I will
eventually be adding either support for subclassing, or extra macros, or some
kind of template-based extensibility.

To the other commenters: thanks :)

As for progress: there are substantial improvements.
- The entire interface is now constexpr, including string functions and
- I ported the interface to C++98, though it still requires __VA_ARGS__. This
makes the topic of this message inaccurate. Should I start a new thread for the
new version when it's up?
- The C++98 conversion means that, in theory, the library should work on MSVC
down to VS2005. I will be testing that when I get my new notebook in a few days.
If successful, Better Enums will be compatible with the 3 major compiler
- Eliminated all weak symbols, leaving only standard C++. Some may be brought
back later for optimization, but they are no longer required.
- When compiling for C++11, there are no more implicit conversions to integers.
- The library is now a single header file, containing both the C++11 version and
the C++98 port, and all helper macros.
- The documentation is getting a major improvement, so please don't look now.

The all-constexpr version is unfortunately noticeably slower to compile. The
performance test that was previously two times faster than including iostream is
now twice as slow, but I can mitigate this with some combination of opt-in and


Boost list run by bdawes at, gregod at, cpdaniel at, john at