nie kompilujący się kod dla visuala 2013

0

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?

0

tutaj:

   printContainer<std::list, int>(wektor); //does't work in visual 2013  (*)

Chyba powinna być lista, nie wektor.

PS. To nie jest tak, że to jest feature z c++17 i visual 2013 go nie wspiera?
https://msdn.microsoft.com/en-us/library/hh567368.aspx#featurelist
typename in template template-parameters

PS2. Zignorujcie komentarz powyżej. To inny feature. Powinno działać.

0

to czeski błąd z tą listą, nie działa ani dla listy ani dla wektora.

1 użytkowników online, w tym zalogowanych: 0, gości: 1