Advertisement
ldionne

Untitled

Jun 19th, 2013
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. TEST_SIZE = 10000
  4. repeat = lambda f: (f(N) for N in range(0, TEST_SIZE))
  5.  
  6. program = ("""
  7. #include <type_traits>
  8.  
  9.  
  10. template <typename ...> struct result;
  11.  
  12. template <typename T>
  13. struct with_cache {
  14.    using without_reference = typename std::remove_reference<T>::type;
  15.    using type = result<""" + ', '.join(repeat(lambda N: "without_reference")) + """>;
  16. };
  17.  
  18. template <typename T>
  19. struct without_cache {
  20.    using type = result<
  21.        """ + ',\n        '.join(repeat(lambda N: "typename std::remove_reference<T>::type")) + """
  22.    >;
  23. };
  24.  
  25. using Result = with_cache<int>::type;
  26.  
  27. int main() { }
  28. """)
  29.  
  30. print(program)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement