The below code doesn't compile for Visual 2013 for printContainer usage. It works in case for example online ccp sh compiler.
template<template<typename... Args> class Container, typename... Types>
void printContainer(Container<Types...> container)
{
for (const auto& x : container)
cout << x << " ";
cout << endl;
}
template<typename Iter>
void printContainer2(Iter begin, Iter end)
{
for (Iter iter = begin; iter != end; ++iter)
cout << *iter << " ";
cout << endl;
}
list<int> lista{ 1, 1, 2, 2, 3, 3, 66, 66, 100, 100 };
vector<int> wektor{ 1, 1, 2, 2, 3, 3, 66, 66, 100, 100 };
printContainer<std::vector, int>(wektor); //does't work in visual 2013 (*)
//error: cannot convert argument 1 from 'std::vector<int, std::allocator<_Ty>>' to std::vector'
printContainer<std::list, int>(wektor); //does't work in visual 2013 (*)
//error the similar as above
printContainer2<vector<int>::iterator>(wektor.begin(), wektor.end());
printContainer2<list<int>::iterator>(lista.begin(), lista.end());
does anybody know how to change line (*) in order code be compilable?