Jonathan Müller

Results 136 comments of Jonathan Müller

Then pack an `#ifdef _MSC_VER` around it :D Maybe you can avoid the branch then completely, is the `struct` before each type?

Damn, then at least make the check only on MSVC. A hash that doesn't change with the platform would be great.

If the language would allow us to have static variables in constexpr functions, this could solve the problem. But sadly, it isn't legal for us - although the compiler can...

I wrote a horrible code which might even be UB: ``` cpp #include template // w/o null-terminator struct string_storage : string_storage { char value; constexpr string_storage(const char *str) : string_storage(str...

Isn't there the same issue with a vanilla array?

But it also uses a character array internally and conditional compilation ensures that no constexpr will be used on MSVC as far as I can see.

Does your macro require a string literal as argument? Since we have static char array and so far the macro techniques for converting this I have seen require string literals.

No, it is a char array, sadly: https://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

I know how we can cache the string! :D Variable templates! ``` template constexpr string get_type_name() {...} template constexpr string type_name = get_type_name(); ``` And type_id_t can now store a...