std::vector<double>(0) creates an empty vector, so we can save some time by just
resizing the vector of vectors instead.
// entry
const ComponentMask ¤t_mask = (component_mask.find (data_store_begin->first))->second;
unsigned int n_stored = current_mask.n_selected_components();
- for (unsigned int component = 0; component < n_stored; component++)
- {
- data_store_begin->second.push_back (std::vector<double> (0));
- }
+ data_store_begin->second.resize(data_store_begin->second.size() + n_stored);
}
}
// entry
const ComponentMask current_mask = (component_mask.find (data_store_begin->first))->second;
unsigned int n_stored = current_mask.n_selected_components();
- for (unsigned int component = 0; component < n_stored; component++)
- {
- data_store_begin->second.push_back (std::vector<double> (0));
- }
+ data_store_begin->second.resize(data_store_begin->second.size() + n_stored);
}
}
}
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams