vector<string> or vector<char *>?
Posted
by
Aaron
on Stack Overflow
See other posts from Stack Overflow
or by Aaron
Published on 2009-02-15T00:15:02Z
Indexed on
2010/12/21
7:54 UTC
Read the original article
Hit count: 287
Question:
What is the difference between:
vector<string>
andvector<char *>
?
How would I pass a value of data type:
string
to a function, that specifically accepts:const char *
?
For instance:
vector<string> args(argv, argv + argc);
vector<string>::iterator i;
void foo (const char *); //*i
- I understand using
vector<char *>
: I'll have to copy the data, as well as the pointer
Edit:
Thanks for input!
© Stack Overflow or respective owner