Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void print (Container c) {
- for (const auto& e : c)
- print (e);
- }
- // Later
- print (std::vector <int> {1, 2, 3, 4});
- void f(double x);
- template <Container C>
- void f(const C& c);
- template <typename T>
- struct Container: std::false_type { };
- template <typename T, size_t N>
- struct Container <std::array<T, N> >: std::true_type { };
- template <typename T, typename A>
- struct Container <std::vector<T, A> >: std::true_type { };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement