I have situation like this
template<class T> class Vector {
T *data;
uint _size, _counter;
public:
class Iterator;
template<template<class> class C> Vector(typename C<T>::Iterator it1,
typename C<T>::Iterator it2) {
data = NULL;
_size = _counter = 0;
for(typename C<T>::Iterator it = it1; it != it2 && it != end(); it++)
push(*it);
}
};
that is my own Vector class and the constructor mimics behaviour of vector (u can construct it with range of data supplied using interators) but add requirement that the container is to be template of the same type as the one under construction. I get error
5.cpp:16:36: error: no matching function for call to ‘Vector::Vector(Vector::Iterator, Vector::Iterator)’ 5.cpp:16:36: note: candidates are: In file included from 5.cpp:2:0:
5.hpp:17:37: note: template class typedef C C> Vector::Vector(typename C::Iterator, typename C::Iterator)
5.hpp:17:37: note: template argument deduction/substitution failed:
5.cpp:16:36: note: couldn't deduce template parameter ‘template class typedef C C’ In file included from 5.cpp:2:0:
5.hpp:11:3: note: Vector::Vector() [with T = int]
5.hpp:11:3: note: candidate expects 0 arguments, 2 provided
5.hpp:7:25: note: Vector::Vector(const Vector&)
5.hpp:7:25: note: candidate expects 1 argument, 2 provided
Need some help in here.