fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <list>
  4. #include <deque>
  5.  
  6. template<template<typename, typename...> class Container, typename... Params>
  7. void foo(Container<int, Params...> const&)
  8. {
  9. std::cout << __PRETTY_FUNCTION__ << '\n';
  10. }
  11.  
  12. int main()
  13. {
  14. foo(std::vector<int>{});
  15. foo(std::list<int>{});
  16. foo(std::deque<int>{});
  17. // foo(std::vector<float>{}); // doesn't compile
  18. }
  19.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
void foo(const Container<int, Params ...>&) [with Container = std::vector; Params = {std::allocator<int>}]
void foo(const Container<int, Params ...>&) [with Container = std::list; Params = {std::allocator<int>}]
void foo(const Container<int, Params ...>&) [with Container = std::deque; Params = {std::allocator<int>}]