Guest User

Untitled

a guest
Nov 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. template <typename T1, typename... Ts>
  2. void doSomething()
  3. {
  4. ...
  5. }
  6.  
  7. template <typename... Ts>
  8. struct MyContainerCreator
  9. {
  10. using type = boost::mpl::set<Ts...>;
  11. };
  12.  
  13. using MyContainer= MyContainerCreator<T1, T2>;
  14.  
  15. void doSomethingForAll()
  16. {
  17. //pseudocode:
  18. doSomething<expandTypesToTemplateParameters<MyContainer::type>>();
  19. }
  20.  
  21. template <typename ... Ts>
  22. void doSomethingForAll (MyContainer<Ts...> const & mc)
  23. {
  24. doSomething<Ts...>();
  25. }
  26.  
  27. template <typename>
  28. struct foo;
  29.  
  30. template <typename ... Ts>
  31. struct foo<MyContainer<Ts...>>
  32. {
  33. static void func ()
  34. { doSomething<Ts...>(); }
  35. };
  36.  
  37. template <typename MC>
  38. void doSomethingForAll ()
  39. { foo<MC>::func(); }
Add Comment
Please, Sign In to add comment