Я действительно не понимаю, почему этот кодСТД картохранилище и шаблонные функции
#include <map>
template<typename T, typename U> std::ostream& operator<<(std::ostream& o,
const std::map<T,U>& input)
{
for (std::map<typename T,typename U>::iterator it=input.begin(); it!=input.end(); ++it)
{
o << it->first << " => " << it->second << '\n';
}
return o;
}
возвращает эту ошибку компиляции:
error: wrong number of template arguments (1, should be 4)
error: provided for ‘template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map’
кто может мне помочь пожалуйста ??
Или еще лучше, использовать ' auto': 'for (auto it = input.begin(); ...' или даже диапазон для цикла: 'for (auto & pair: input)' – Angew