C++ Logo

std-proposals

Advanced search

Re: enum class value name string via something similar to typeid().name() ?

From: Sebastian Büttner <sebastian.buettner_at_[hidden]>
Date: Sat, 09 Nov 2019 20:57:52 +0000
I aggree on both your statements.

However I still think that the problem is just one of many in that domain.
With reflection at hand we will be able to solve this and even way more like
enumerating class members and so on.

WG21 still has no common direction on this, however significant work has
already been done. It is still a long way to go tho. There is at least one
major proposal on this in flight (with some serious opposition to it).

You might want to have a look at P1240 (Scalable Reflection in C++, http://
www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1240r1.pdf).

The first example on page 2 is already what you are looking for (kinda at
least).

Sebastian



On Samstag, 9. November 2019 19:40:41 UTC Jonny Grant wrote:

>
> Seems a shame if we need to write a python script to generate the
> to_string_str for each enum.
>
>
>
> Don't you just hate it when you get a debug log that shows :-
>

Received on 2019-11-09 15:00:14