Answer the question
In order to leave comments, you need to log in
How to reach element in foreach?
The situation is this. I am getting values from the database.
auto newimages = db.stmt.executeQuery("тут сам запрос");
while(newimages.next())
{
string url = newimages.getString(4);
string name = newimages.getString(6);
string myalis = newimages.getString(10);
string month = newimages.getString(11);
string year = newimages.getString(12);
urls ~= url;
names ~= name;
myalises ~= myalis;
}
foreach(i, url; urls)
{
Answer the question
In order to leave comments, you need to log in
If the order in the urls list matches the order in the myaliases list.
std::list<string>::iterator myalis=myalises.begin();
for(const auto& url: urls) {
std::cout << url << *myalis << std::endl;
++myalis;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question