Boost logo

Boost :

Subject: Re: [boost] Feedback desired for reflective enum library
From: Nir Friedman (quicknir_at_[hidden])
Date: 2019-01-12 14:15:21

I had to fill in the subject for this manually, because of settings for the
mailing list. I really hope it ends up on the right thread. Apologies if it

Hi Geert,

There is an ADAPT macro, which is similar to your concept of
CONVERT_TO_WISE_ENUM. However, it does require listing the enumerators;
after all there's no way to find them out after the fact or else this
library wouldn't exist in the first place.

That said, I'm not quite sure what you mean by "changing your whole
codebase". To take advantage of wise enums, all you'd need to do is change
the original enum declaration to the wise enum macro. Everything else in
your codebase will continue to work exactly as before. No typedef
shenangians are necessary. Changing the original enum declaration is
exactly the same amount of work as writing an adapt macro, but you don't
have to maintain the list of enumerators twice. So I can't imagine a reason
to write things the way you have (unless you want a conditional build
dependency on WISE_ENUM but that seems unnecessary).

The ADAPT macro is designed to be use wise_enum functionality generically
with enumerators whose source you don't control, and therefore cannot
change the declaration.

Hope that clarifies things.



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