libcamera: Replace iterators with range-based for loops
Use range-based for loops instead of iterators when iterating over a container. This improves readability. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
This commit is contained in:
@@ -110,13 +110,13 @@ std::string join(const Container &items, const std::string &sep, UnaryOp op)
|
||||
std::ostringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto it = std::begin(items); it != std::end(items); ++it) {
|
||||
for (const auto &item : items) {
|
||||
if (!first)
|
||||
ss << sep;
|
||||
else
|
||||
first = false;
|
||||
|
||||
ss << op(*it);
|
||||
ss << op(item);
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
@@ -128,13 +128,13 @@ std::string join(const Container &items, const std::string &sep)
|
||||
std::ostringstream ss;
|
||||
bool first = true;
|
||||
|
||||
for (auto it = std::begin(items); it != std::end(items); ++it) {
|
||||
for (const auto &item : items) {
|
||||
if (!first)
|
||||
ss << sep;
|
||||
else
|
||||
first = false;
|
||||
|
||||
ss << *it;
|
||||
ss << item;
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
|
||||
Reference in New Issue
Block a user