, , , std::map :
template<class Key,
class Value,
class Predicate = std::less<Key>,
class Allocator = std::allocator<pair<const Key, Value> > >
class map;
, :
template < typename TKey,
typename TVal,
class TPr,
class TAl
template<typename,typename,class,class> TContainer >
void func(const TContainer<TKey, TVal, TPr, TAl>& container)
{
for (typename TContainer<TKey, TVal, TPr, TAl>::iterator it = container.begin(); it != container.end(); ++it)
{
do_something(it->second);
}
}
, , . :
template <typename FwdIt>
void func(FwdIt begin, FwdIt end)
{
while(begin != end) {
do_something(begin->second);
++begin;
}
}
, :
void f(const std::vector< std::pair<int, std::string> >& v)
{
func( v.begin(), v.end() );
}