3

I want to write a function that accepts any container holding strings. Something like this:

template <typename Container> void foo(Container<string>& stuff);

But this isn't the right syntax. What's the right syntax?

Kyle
  • 4,487
  • 3
  • 29
  • 45

1 Answers1

4

You need a template template parameter:

template < template <typename> class Container> void foo (Container<string>& stuff);
MSN
  • 53,214
  • 7
  • 75
  • 105