
Wrong constructor used for vector<string>.
Hi,
I have problems compiling the following code in VC++ 6.
Can someone give me a clue on how to work around the
problem.
(The code compiles with VS .NET)
Regards,
Peter
---
#include <string>
#include <vector>
int main(int argc, const char *argv[]) {
std::vector<std::string> a(&argv[0], &argv[argc]);
return 0;
Quote:
}
---
I guess the compiler finds the following constructor:
explicit vector(size_type n, const T& v = T(), const A& al
= A());
instead of this one:
vector(const_iterator first, const_iterator last,
const A& al = A());
I get the following error message:
Edited version:
vector<string>::vector<string>(unsigned int,const string
&,const class allocator<string > &)' :
cannot convert parameter 1 from 'char ** ' to 'unsigned
int'
Full version:
d:\private\argtest\m.cpp(5) : error C2664: '__thiscall
std::vector<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >,class
std::allocator<class std::basic_string<char,struct
std::char_traits<char>,class std::all
ocator<char> > > >::std::vector<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >,class std::allocator<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > > >(unsigned int,con
st class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >
&,const class std::allocator<class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > > &)' : cannot convert parameter 1
from '
char ** ' to 'unsigned int'