tags:

views:

50

answers:

1

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?

+3  A: 

You need a template template parameter:

template < template <typename> class Container> void foo (Container<string>& stuff);
MSN
`template <typename> class Container`.
KennyTM
Yep, the second typename needs to be class instead, and it works. Thanks!
Kyle
The last sentence of that linked page is wrong. See [my question](http://stackoverflow.com/questions/1469743/standard-library-containers-with-additional-optional-template-parameters)
Johannes Schaub - litb
@KennyTM, @Kyle, fixed! Whee...
MSN