Better HN
topnewbestaskshowjobs
Log inSign up

neargye

33 karma · joined Mar 23, 2019 (7y ago) · 16 submissions

Submissions

1.

Show HN: Enum to_string, from_string, iterating for modern C++, without macro(github.com ↗)

2 points · by neargye · 7y ago · discuss

2.

Static reflection for enums (to string, from string, iteration) for modern C++(github.com ↗)

4 points · by neargye · 7y ago · discuss

3.

Show HN: Static reflection on enums for modern C++(github.com ↗)

3 points · by neargye · 7y ago · discuss

comment 7y ago · link · parent

New version supported GCC >= 9

comment 7y ago · link · parent

yeap, I use __PRETTY_FUNCTION__.

comment 7y ago · link · parent

To be sure: nameof(c) returns "c" (nameof return name of variable) nameof_enum(c) returns "RED" (nameof_enum return enum name of enum variable)

comment 7y ago · link · parent

You are absolutely right :)

comment 7y ago · link · parent

With features C++17 this header looks not so terribly.

comment 7y ago · link · parent

I usually check the newest versions of compilers, and if the behavior changes, then I update the code

comment 7y ago · link · parent

https://stackoverflow.com/a/31163837/9514814

comment 7y ago · link · parent

In fact, not so much about the whole big project. May add a few seconds to the compilation.

comment 7y ago · link · parent

In our project, NAMEOF_TYPE and NAMEOF almost do not add time relative to the entire project. But NAMEOF_ENUM can add a couple of seconds to large enums.

comment 7y ago · link · parent

Unfortunately, yes, I'm still looking for a solution for gcc

14.

Show HN: Nameof Operator for Modern C++(github.com ↗)

65 points · by neargye · 7y ago · 23 comments

comment 7y ago · link · parent

Header-only C++17 library provides nameof macros and functions to obtain simple name of variable, type, function, macro, and enum.

Before, you had to use string literals to refer to definitions, which is brittle when renaming code elements because tools do not know to check these string literals.

Try it online: https://wandbox.org/permlink/ffnImjrPVcZR2l5y

16.

Nameof Operator for Modern C++(github.com ↗)

2 points · by neargye · 7y ago · 1 comment