fork download
  1. #include <iostream>
  2. #include <tuple>
  3.  
  4. template<class T> struct Convert;
  5. template<> struct Convert<int> {typedef bool Type;};
  6. template<> struct Convert<char> {typedef int Type;};
  7. template<> struct Convert<bool> {typedef char Type;};
  8.  
  9. template <typename... Args>
  10. struct convert;
  11.  
  12. template <typename... Args>
  13. struct convert<std::tuple<Args...>>
  14. {
  15. typedef std::tuple<typename Convert<Args>::Type...> type;
  16. };
  17.  
  18. int main()
  19. {
  20. static_assert(
  21. std::is_same<
  22. convert<std::tuple<int, char, bool>>::type,
  23. std::tuple<bool, int, char>
  24. >::value, ""
  25. );
  26. }
Success #stdin #stdout 0s 2848KB
stdin
Standard input is empty
stdout
Standard output is empty