fork download
  1. #include <iostream>
  2.  
  3. template<class T>struct identity{using type=T;};
  4.  
  5. template <typename T, template<class>class Z=identity>
  6. struct Yin {
  7. template<class U>using Z_t=typename Z<U>::type;
  8. Z_t<T> *m_ptr;
  9. };
  10.  
  11. template <typename T, template<class>class Z=identity>
  12. struct Yang {
  13. template<class U>using Z_t=typename Z<U>::type;
  14. Z_t<T> *m_ptr;
  15. };
  16.  
  17. template<
  18. template<class, template<class>class>class Yin,
  19. template<class, template<class>class>class Yang
  20. >
  21. struct flopper {
  22. template<class T> struct flip {
  23. using type = Yang<T, flopper<Yang, Yin>::template flip>;
  24. };
  25. };
  26.  
  27. using ying = Yin< void, flopper<Yin, Yang>::template flip >;
  28. using yang = Yang< void, flopper<Yang, Yin>::template flip >;
  29.  
  30.  
  31. int main() {
  32. ying a = {nullptr};
  33. yang b = {&a};
  34.  
  35. // your code goes here
  36. return 0;
  37. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty