- // The formats recognised by LyX
- Formats::const_iterator begin = theFormats().begin();
- Formats::const_iterator end = theFormats().end();
-
- // The formats natively loadable.
- vector<string> nformat = frontend::loadableImageFormats();
-
- vector<string>::const_iterator it = nformat.begin();
- for (; it != nformat.end(); ++it) {
- for (Formats::const_iterator fit = begin; fit != end; ++fit) {
- if (fit->extension() == *it) {
- fmts.push_back(fit->name());
+ for (string const & native_extension : frontend::loadableImageFormats()) {
+ for (Format const & format : theFormats()) {
+ if (format.extension() == native_extension) {
+ fmts.push_back(format.name());