Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -83,8 +83,8 @@ PyObject* WorkbenchPy::listMenus(PyObject *args)
|
||||
std::list<std::string> menus = getWorkbenchPtr()->listMenus();
|
||||
|
||||
Py::List list;
|
||||
for (std::list<std::string>::iterator it = menus.begin(); it != menus.end(); ++it) {
|
||||
list.append(Py::String(*it));
|
||||
for (const auto & menu : menus) {
|
||||
list.append(Py::String(menu));
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
@@ -100,8 +100,8 @@ PyObject* WorkbenchPy::listToolbars(PyObject *args)
|
||||
std::list<std::string> bars = getWorkbenchPtr()->listToolbars();
|
||||
|
||||
Py::List list;
|
||||
for (std::list<std::string>::iterator it = bars.begin(); it != bars.end(); ++it) {
|
||||
list.append(Py::String(*it));
|
||||
for (const auto & bar : bars) {
|
||||
list.append(Py::String(bar));
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
@@ -138,8 +138,8 @@ PyObject* WorkbenchPy::listCommandbars(PyObject *args)
|
||||
std::list<std::string> bars = getWorkbenchPtr()->listCommandbars();
|
||||
|
||||
Py::List list;
|
||||
for (std::list<std::string>::iterator it = bars.begin(); it != bars.end(); ++it) {
|
||||
list.append(Py::String(*it));
|
||||
for (const auto & bar : bars) {
|
||||
list.append(Py::String(bar));
|
||||
}
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
|
||||
Reference in New Issue
Block a user