Мне нужно хранить элементы массива переменного тока в векторе.
В основном мне нужно скопировать все элементы массива переменного тока в vector<std::string>
.
#include<vector>
#include<conio.h>
#include<iostream>
using namespace std;
int main()
{
char *a[3]={"field1","field2","field3"};
//Some code here!!!!
vector<std::string>::const_iterator it=fields.begin();
for(;it!=fields.end();it++)
{
cout<<*it++<<endl;
}
getch();
}
МожетКто-нибудь помочь мне сохранить элементы массива c в векторе?
РЕДАКТИРОВАТЬ
этот код ниже дамп ядра !! Pls help
int main()
{
char *a[3]={"field1","field2","field3"};
std::vector<std::string> fields(a, a + 3);
vector<std::string>::const_iterator it=fields.begin();
for(;it!=fields.end();it++)
{
cout<<*it++<<endl;
}
getch();
}