let's say I have a function like this:
and I would call it as follows:Code:template<typename ContainerT, typename ValueT> void foo(const ContainerT<ValueT>& c) { typedef ContainerT<ValueT> type; for (type::iterator it = c.begin(); it != c.end(); ++it) { // do some stuff } }
obviously this will not compile, because the compiler has no way of knowing that ContainerT is a template type.Code:std::vector<int> intVector; std::list<std::string> stringList; foo(intVector); foo(stringList);
is there any way to make something like this work?



LinkBack URL
About LinkBacks



