fork download
  1. #include <iostream>
  2.  
  3. template<class T>struct identity{using type=T;};
  4. template<class T>using identity_t=typename identity<T>::type;
  5.  
  6. template <typename T, template<class>class Z=identity_t>
  7. struct Yin {
  8. Z<T> *m_ptr;
  9. };
  10.  
  11. template <typename T, template<class>class Z=identity_t>
  12. struct Yang {
  13. Z<T> *m_ptr;
  14. };
  15.  
  16. template<
  17. template<class, template<class>class>class Yin,
  18. template<class, template<class>class>class Yang
  19. >
  20. struct flopper {
  21. template<class T> struct flip {
  22. template<class U> using flop_t=typename flopper<Yang, Yin>::template flip_t<U>;
  23. using type = Yang<T, flop_t>;
  24. };
  25. template<class T> using flip_t=typename flip<T>::type;
  26. };
  27.  
  28. using yin = Yin< void, flopper<Yin, Yang>::template flip_t >;
  29. using yang = Yang< void, flopper<Yang, Yin>::template flip_t >;
  30.  
  31.  
  32. int main() {
  33. yin a={nullptr};
  34. yang b={&a};
  35. // your code goes here
  36. return 0;
  37. }
Compilation error #stdin compilation error #stdout 0s 3336KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:34:12: error: cannot convert ‘yin* {aka Yin<void, flopper<Yin, Yang>::flip_t>*}’ to ‘flopper<Yang, Yin>::flip_t<void>* {aka Yin<void, flopper<Yang, Yin>::flip<void>::flop_t>*}’ in initialization
  yang b={&a};
            ^
prog.cpp:34:7: warning: unused variable ‘b’ [-Wunused-variable]
  yang b={&a};
       ^
stdout
Standard output is empty