I've currently reached an issue where attempting to use an auto-for iterator loop is failing, but is not due to an invalid usage (e.g. using end()
incorrectly).
With this code, the at()
usage works fine, but the iterator one fails (regardless of auto or manual specification):
size_t sz = cfg_profiles.size();
for ( size_t i = 0; i < sz; i++ )
{
responses[id]->str_vect.emplace_back(cfg_profiles.at(i).profile_name);
}
for ( auto& prf : cfg_profiles )
{
responses[id]->str_vect.emplace_back(prf.profile_name);
}
cfg_profiles
is a std::vector<config_profile>
, where config_profile
is a struct containing strings, a string vector, and a 'deep-copy' assignment constructor. It was populated earlier by the same library (and file).
I've tracked the issue down to the container proxy being missing, as pictured - though I have no idea how it's been able to get into this state:
I can guarantee the vector is not being modified elsewhere, as this is running in a std::thread
created by, and member of, the owning class.
I tried making a minimal, reproducible form in a new project without success - is there any reason the vector could get into this state, or somewhere obvious I should be looking?
Aucun commentaire:
Enregistrer un commentaire