J
Johann Gerell
I have this iterator:
class CFileIterator : public std::iterator<std::input_iterator_tag,
const std::wstring>
{
public:
CFileIterator(const std::wstring& wildcardPath);
....
};
which I instantiate like this:
CFileIterator it(SomePathWithWildcard), end;
I was hoping to be able to fill a vector using the iterator, like this:
std::vector<std::wstring> filenames(it, end);
but the compiler spits this into my face:
error C2664:
'std::vector<_Ty>::vector(std::vector<_Ty>::size_type,
const _Ty &,const _A &)'
: cannot convert parameter 1 from 'CFileIterator'
to 'std::vector<_Ty>::size_type'
Apparently, the compiler believes I want to call the vector ctor
vector(size_type, const Type&, const Allocator&);
instead of
template<class InputIterator>
vector(InputIterator, InputIterator, const Allocator&);
I use the aged and all but standards compliant Dinkumware STL bundled
with Platform Builder 5 - it's probably the same that shipped with old
Visual C++ 6.
Any ideas what I might try to get resolve the ctor call correctly?
class CFileIterator : public std::iterator<std::input_iterator_tag,
const std::wstring>
{
public:
CFileIterator(const std::wstring& wildcardPath);
....
};
which I instantiate like this:
CFileIterator it(SomePathWithWildcard), end;
I was hoping to be able to fill a vector using the iterator, like this:
std::vector<std::wstring> filenames(it, end);
but the compiler spits this into my face:
error C2664:
'std::vector<_Ty>::vector(std::vector<_Ty>::size_type,
const _Ty &,const _A &)'
: cannot convert parameter 1 from 'CFileIterator'
to 'std::vector<_Ty>::size_type'
Apparently, the compiler believes I want to call the vector ctor
vector(size_type, const Type&, const Allocator&);
instead of
template<class InputIterator>
vector(InputIterator, InputIterator, const Allocator&);
I use the aged and all but standards compliant Dinkumware STL bundled
with Platform Builder 5 - it's probably the same that shipped with old
Visual C++ 6.
Any ideas what I might try to get resolve the ctor call correctly?