Hi, You may want to check out our (Mine and Jonathan Müller's) CTTI library, which already implements that constexpr type_id, supporting GCC 5.X, Clang, and VS2015 https://github.com/Manu343726/ctti (This post may also add some context http://manu343726.github.io/2016/03/13/the-road-for-reflection-tagging-types... ) I will be glad to give you some feedback on this. El vie., 25 de marzo de 2016 18:04, Klemens Morgenstern < klemens.morgenstern@gmx.net> escribió:
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?
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost