I've tired the following:
#include
#include <iostream> template <class T> struct ctti { static constexpr const char* n() noexcept { return BOOST_CURRENT_FUNCTION + 5; } };
int main() { constexpr auto c = ctti<int>::n() + 10; std::cerr << c; }
Ok, might be possible. But you still get problems when passing const char* as a template parameter which you still would need to do in order to get the type. I.e. I can't use a null-terminated string, but need an array of chars and it's size.
And that worked on GCC5.3 and Clang3.7. Looks like it's time to continue the work on https://github.com/apolukhin/type_index/tree/constexpr14 and make the type_index constexpr :)
Ah, then I'll redirect my PR.
Actually you do not need to add types. The code must work with any POD type as member types are either 1) fundamental types (that are registered) 2) or PODs, then goto step 1) for that member
Oh, I thought you'd need to register POD-Types. What about enumerators?