Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <typeinfo>
- #include <cstdlib>
- #include <cassert>
- #include <cxxabi.h>
- template< typename ...types >
- struct V // implementation
- {
- using type = V;
- };
- template< typename ...first, typename ...second, typename ...rest >
- struct V< V< first... >, V< second... >, rest... >
- : V< V< first..., second... >, rest... >
- {
- };
- template< typename first, typename ...second, typename ...rest >
- struct V< first, V< second... >, rest... >
- : V< V< first, second... >, rest... >
- {
- };
- template< typename ...first, typename second, typename ...rest >
- struct V< V< first... >, second, rest... >
- : V< V< first..., second >, rest... >
- {
- };
- template< typename ...types >
- struct V< V< types... > >
- : V< types... >
- {
- };
- template< int i >
- struct T
- {
- };
- int
- main()
- {
- auto name = typeid(typename V< T< 0 >, V< T< 1 >, T< 2 > >, T< 3 >, T< 4 >, V< T< 5 >, T< 6 > >, V< T< 7 >, T< 8 > >, T< 9 > >::type).name();
- int status = -4;
- char * demangled_name = abi::__cxa_demangle(name, nullptr, nullptr, &status);
- assert(!(status < 0));
- std::cout << demangled_name << std::endl;
- std::free(demangled_name);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment