aboutsummaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
authorAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-08-04 21:57:23 -0700
committerAvatar Saleem Abdulrasool <compnerd@compnerd.org> 2016-08-04 22:11:01 -0700
commitf3cd2455110fad09158275287cbdaa67cc3e15c3 (patch)
treeb1922ea17b1401f0e86c6e3cdaf3a278dade4557 /src/clients
parente9ccc3a086f57507712a44ef2fadc34affa13af9 (diff)
downloadpaludis-f3cd2455110fad09158275287cbdaa67cc3e15c3.tar.gz
paludis-f3cd2455110fad09158275287cbdaa67cc3e15c3.tar.xz
modernize: convert to range based for-loops
Automated conversion to range based for loops. NFC
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/cave/cmd_display_resolution.cc64
-rw-r--r--src/clients/cave/cmd_dump_cave_formats_conf.cc13
-rw-r--r--src/clients/cave/cmd_find_candidates.cc44
-rw-r--r--src/clients/cave/cmd_fix_cache.cc7
-rw-r--r--src/clients/cave/cmd_info.cc26
-rw-r--r--src/clients/cave/cmd_print_unmanaged_files.cc5
-rw-r--r--src/clients/cave/cmd_print_unused_distfiles.cc9
-rw-r--r--src/clients/cave/cmd_show.cc40
-rw-r--r--src/clients/cave/cmd_sync.cc5
-rw-r--r--src/clients/cave/resolve_common.cc17
10 files changed, 100 insertions, 130 deletions
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index e8d18f133..5ec79cc2a 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -391,13 +391,11 @@ namespace
}
cout << fuc(fs_explanation_constraints_header());
- for (auto c(reasons_for_constraints.begin()), c_end(reasons_for_constraints.end()) ;
- c != c_end ; ++c)
+ for (auto & reasons_for_constraint : reasons_for_constraints)
{
- cout << fuc(fs_explanation_constraint(), fv<'c'>(c->first));
- for (auto r(c->second.begin()), r_end(c->second.end()) ;
- r != r_end ; ++r)
- cout << fuc(fs_explanation_constraint_reason(), fv<'r'>(*r));
+ cout << fuc(fs_explanation_constraint(), fv<'c'>(reasons_for_constraint.first));
+ for (const auto & r : reasons_for_constraint.second)
+ cout << fuc(fs_explanation_constraint_reason(), fv<'r'>(r));
}
}
@@ -744,16 +742,14 @@ namespace
reasons.insert(r.first);
}
- for (std::set<std::string>::const_iterator r(changes_reasons.begin()), r_end(changes_reasons.end()) ;
- r != r_end ; ++r)
+ for (const auto & changes_reason : changes_reasons)
{
- special_reasons.erase(*r);
- reasons.erase(*r);
+ special_reasons.erase(changes_reason);
+ reasons.erase(changes_reason);
}
- for (std::set<std::string>::const_iterator r(special_reasons.begin()), r_end(special_reasons.end()) ;
- r != r_end ; ++r)
- reasons.erase(*r);
+ for (const auto & special_reason : special_reasons)
+ reasons.erase(special_reason);
if (reasons.empty() && special_reasons.empty() && changes_reasons.empty())
return;
@@ -765,9 +761,8 @@ namespace
if (! changes_reasons.empty())
{
cout << fuc(fs_changes_reasons_start());
- for (std::set<std::string>::const_iterator r(changes_reasons.begin()), r_end(changes_reasons.end()) ;
- r != r_end ; ++r)
- cout << fuc(fs_reason_changes(), fv<'c'>(++n_shown != 1 ? ", " : ""), fv<'r'>(*r));
+ for (const auto & changes_reason : changes_reasons)
+ cout << fuc(fs_reason_changes(), fv<'c'>(++n_shown != 1 ? ", " : ""), fv<'r'>(changes_reason));
cout << fuc(fs_changes_reasons_end());
}
@@ -775,13 +770,11 @@ namespace
cout << fuc(fs_reasons());
n_shown = 0;
- for (std::set<std::string>::const_iterator r(special_reasons.begin()), r_end(special_reasons.end()) ;
- r != r_end ; ++r)
- cout << fuc(fs_reason_special(), fv<'c'>(++n_shown != 1 ? ", " : ""), fv<'r'>(*r));
+ for (const auto & special_reason : special_reasons)
+ cout << fuc(fs_reason_special(), fv<'c'>(++n_shown != 1 ? ", " : ""), fv<'r'>(special_reason));
int n_remaining(reasons.size());
- for (std::set<std::string>::const_iterator r(reasons.begin()), r_end(reasons.end()) ;
- r != r_end ; ++r)
+ for (const auto & reason : reasons)
{
if (n_shown >= 3 && n_remaining > 1)
{
@@ -790,7 +783,7 @@ namespace
}
--n_remaining;
- cout << fuc(fs_reason_normal(), fv<'c'>(++n_shown != 1 ? ", " : ""), fv<'r'>(*r));
+ cout << fuc(fs_reason_normal(), fv<'c'>(++n_shown != 1 ? ", " : ""), fv<'r'>(reason));
}
cout << fuc(fs_reasons_end());
@@ -1381,17 +1374,16 @@ namespace
(*c)->reason()->accept_returning<std::pair<std::string, Tribool> >(g).first);
}
- for (auto c(duplicates.begin()), c_end(duplicates.end()) ;
- c != c_end ; ++c)
+ for (auto & duplicate : duplicates)
{
- auto constraint(c->second.first);
+ auto constraint(duplicate.second.first);
ReasonNameGetter g(false, true);
std::string s(constraint_as_string(*constraint) + " from " +
constraint->reason()->accept_returning<std::pair<std::string, Tribool> >(g).first);
- if (c->second.second.size() > 1)
- s.append(" (and " + stringify(c->second.second.size() - 1) + " more)");
+ if (duplicate.second.second.size() > 1)
+ s.append(" (and " + stringify(duplicate.second.second.size() - 1) + " more)");
cout << fuc(fs_unable_unsuitable_did_not_meet(), fv<'s'>(s));
if (constraint->spec().if_package() && constraint->spec().if_package()->additional_requirements_ptr() &&
@@ -1420,21 +1412,19 @@ namespace
{
Context context("When displaying choices to explain:");
- for (ChoicesToExplain::const_iterator p(choices_to_explain.begin()), p_end(choices_to_explain.end()) ;
- p != p_end ; ++p)
+ for (const auto & p : choices_to_explain)
{
- cout << fuc(fs_choice_to_explain_prefix(), fv<'s'>(p->first));
+ cout << fuc(fs_choice_to_explain_prefix(), fv<'s'>(p.first));
- for (ChoiceValuesToExplain::const_iterator v(p->second.begin()), v_end(p->second.end()) ;
- v != v_end ; ++v)
+ for (const auto & v : p.second)
{
bool all_same(true);
const std::shared_ptr<const ChoiceValue> first_choice_value(
- (*v->second->begin())->choices_key()->parse_value()->find_by_name_with_prefix(v->first));
+ (*v.second->begin())->choices_key()->parse_value()->find_by_name_with_prefix(v.first));
std::string description(first_choice_value->description());
- for (PackageIDSequence::ConstIterator w(next(v->second->begin())), w_end(v->second->end()) ;
+ for (PackageIDSequence::ConstIterator w(next(v.second->begin())), w_end(v.second->end()) ;
w != w_end ; ++w)
- if ((*w)->choices_key()->parse_value()->find_by_name_with_prefix(v->first)->description() != description)
+ if ((*w)->choices_key()->parse_value()->find_by_name_with_prefix(v.first)->description() != description)
{
all_same = false;
break;
@@ -1445,11 +1435,11 @@ namespace
else
{
cout << fuc(fs_choice_to_explain_not_all_same(), fv<'s'>(stringify(first_choice_value->unprefixed_name())));
- for (PackageIDSequence::ConstIterator w(v->second->begin()), w_end(v->second->end()) ;
+ for (PackageIDSequence::ConstIterator w(v.second->begin()), w_end(v.second->end()) ;
w != w_end ; ++w)
{
const std::shared_ptr<const ChoiceValue> value(
- (*w)->choices_key()->parse_value()->find_by_name_with_prefix(v->first));
+ (*w)->choices_key()->parse_value()->find_by_name_with_prefix(v.first));
cout << fuc(fs_choice_to_explain_one(), fv<'s'>((*w)->canonical_form(idcf_no_version)), fv<'d'>(value->description()));
}
}
diff --git a/src/clients/cave/cmd_dump_cave_formats_conf.cc b/src/clients/cave/cmd_dump_cave_formats_conf.cc
index 4f8761bcf..c9bc557af 100644
--- a/src/clients/cave/cmd_dump_cave_formats_conf.cc
+++ b/src/clients/cave/cmd_dump_cave_formats_conf.cc
@@ -219,13 +219,12 @@ DumpCaveFormatsConfCommand::run(
get_formats.collect();
std::string current_section;
- for (auto i(get_formats.storers.begin()), i_end(get_formats.storers.end()) ;
- i != i_end ; ++i)
+ for (auto & storer : get_formats.storers)
{
- std::string::size_type p(i->first.find("/"));
+ std::string::size_type p(storer.first.find("/"));
if (std::string::npos == p)
- throw InternalError(PALUDIS_HERE, "weird key " + i->first);
- std::string section(i->first.substr(0, p)), key(i->first.substr(p + 1));
+ throw InternalError(PALUDIS_HERE, "weird key " + storer.first);
+ std::string section(storer.first.substr(0, p)), key(storer.first.substr(p + 1));
if (current_section != section)
{
@@ -234,9 +233,9 @@ DumpCaveFormatsConfCommand::run(
}
cout << key << " = ";
- if (0 == i->second.value.compare(0, 1, " "))
+ if (0 == storer.second.value.compare(0, 1, " "))
cout << "\\";
- cout << i->second.value << endl;
+ cout << storer.second.value << endl;
}
return EXIT_SUCCESS;
diff --git a/src/clients/cave/cmd_find_candidates.cc b/src/clients/cave/cmd_find_candidates.cc
index 1e278d461..f7b1dd39c 100644
--- a/src/clients/cave/cmd_find_candidates.cc
+++ b/src/clients/cave/cmd_find_candidates.cc
@@ -175,8 +175,7 @@ FindCandidatesCommand::run_hosted(
SearchExtrasHandle::get_instance()->cleanup_db_function(db);
- for (auto s(specs.begin()), s_end(specs.end()) ;
- s != s_end ; ++s)
+ for (auto & spec : specs)
{
step("Checking indexed candidates");
@@ -190,10 +189,9 @@ FindCandidatesCommand::run_hosted(
{
bool ok(false);
- for (auto m(matches.begin()), m_end(matches.end()) ;
- m != m_end ; ++m)
- if (match_package(*env, *m, *(*env)[selection::RequireExactlyOne(generator::Matches(
- parse_user_package_dep_spec(*s, env.get(), { }), nullptr, { }))]->begin(), nullptr, { }))
+ for (auto & matche : matches)
+ if (match_package(*env, matche, *(*env)[selection::RequireExactlyOne(generator::Matches(
+ parse_user_package_dep_spec(spec, env.get(), { }), nullptr, { }))]->begin(), nullptr, { }))
{
ok = true;
break;
@@ -203,7 +201,7 @@ FindCandidatesCommand::run_hosted(
continue;
}
- yield(parse_user_package_dep_spec(*s, env.get(), { }));
+ yield(parse_user_package_dep_spec(spec, env.get(), { }));
}
}
else if (! search_options.a_matching.specified())
@@ -218,10 +216,9 @@ FindCandidatesCommand::run_hosted(
step("Searching categories");
CategoryNames category_names;
- for (RepositoryNames::const_iterator r(repository_names.begin()), r_end(repository_names.end()) ;
- r != r_end ; ++r)
+ for (const auto & repository_name : repository_names)
{
- const std::shared_ptr<const Repository> repo(env->fetch_repository(*r));
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(repository_name));
const std::shared_ptr<const CategoryNamePartSet> cats(repo->category_names({ }));
std::copy(cats->begin(), cats->end(), std::inserter(category_names, category_names.end()));
}
@@ -229,22 +226,19 @@ FindCandidatesCommand::run_hosted(
step("Searching packages");
QualifiedPackageNames package_names;
- for (RepositoryNames::const_iterator r(repository_names.begin()), r_end(repository_names.end()) ;
- r != r_end ; ++r)
+ for (const auto & repository_name : repository_names)
{
- const std::shared_ptr<const Repository> repo(env->fetch_repository(*r));
- for (CategoryNames::const_iterator c(category_names.begin()), c_end(category_names.end()) ;
- c != c_end ; ++c)
+ const std::shared_ptr<const Repository> repo(env->fetch_repository(repository_name));
+ for (const auto & category_name : category_names)
{
- const std::shared_ptr<const QualifiedPackageNameSet> qpns(repo->package_names(*c, { }));
+ const std::shared_ptr<const QualifiedPackageNameSet> qpns(repo->package_names(category_name, { }));
std::copy(qpns->begin(), qpns->end(), std::inserter(package_names, package_names.end()));
}
}
step("Searching versions");
- for (QualifiedPackageNames::const_iterator q(package_names.begin()), q_end(package_names.end()) ;
- q != q_end ; ++q)
+ for (const auto & package_name : package_names)
{
try
{
@@ -252,12 +246,12 @@ FindCandidatesCommand::run_hosted(
{
if (search_options.a_visible.specified())
{
- const auto ids((*env)[selection::AllVersionsUnsorted(generator::Package(*q) | filter::NotMasked())]);
+ const auto ids((*env)[selection::AllVersionsUnsorted(generator::Package(package_name) | filter::NotMasked())]);
check_candidates(yield, step, ids);
}
else
{
- const auto ids((*env)[selection::AllVersionsUnsorted(generator::Package(*q))]);
+ const auto ids((*env)[selection::AllVersionsUnsorted(generator::Package(package_name))]);
check_candidates(yield, step, ids);
}
}
@@ -265,19 +259,19 @@ FindCandidatesCommand::run_hosted(
{
std::shared_ptr<const PackageIDSequence> ids;
- ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]);
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(package_name) | filter::SupportsAction<InstallAction>() | filter::NotMasked())]);
if (search_options.a_visible.specified())
{
if (ids->empty())
- ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::NotMasked())]);
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(package_name) | filter::NotMasked())]);
}
else
{
if (ids->empty())
- ids = ((*env)[selection::BestVersionOnly(generator::Package(*q) | filter::SupportsAction<InstallAction>())]);
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(package_name) | filter::SupportsAction<InstallAction>())]);
if (ids->empty())
- ids = ((*env)[selection::BestVersionOnly(generator::Package(*q))]);
+ ids = ((*env)[selection::BestVersionOnly(generator::Package(package_name))]);
}
check_candidates(yield, step, ids);
@@ -289,7 +283,7 @@ FindCandidatesCommand::run_hosted(
}
catch (const Exception & e)
{
- std::cerr << "When processing '" << *q << "' got exception '" << e.message() << "' (" << e.what() << ")" << std::endl;
+ std::cerr << "When processing '" << package_name << "' got exception '" << e.message() << "' (" << e.what() << ")" << std::endl;
retcode |= 1;
}
}
diff --git a/src/clients/cave/cmd_fix_cache.cc b/src/clients/cave/cmd_fix_cache.cc
index 16a745308..01d580b3c 100644
--- a/src/clients/cave/cmd_fix_cache.cc
+++ b/src/clients/cave/cmd_fix_cache.cc
@@ -140,11 +140,10 @@ FixCacheCommand::run(
r != r_end; ++r)
repository_names.insert(r->name());
- for (std::set<RepositoryName>::const_iterator r(repository_names.begin()), r_end(repository_names.end()) ;
- r != r_end; ++r)
+ for (const auto & repository_name : repository_names)
{
- cout << fuc(fs_fixing(), fv<'s'>(stringify(*r)));
- const std::shared_ptr<Repository> repo(env->fetch_repository(*r));
+ cout << fuc(fs_fixing(), fv<'s'>(stringify(repository_name)));
+ const std::shared_ptr<Repository> repo(env->fetch_repository(repository_name));
repo->regenerate_cache();
}
diff --git a/src/clients/cave/cmd_info.cc b/src/clients/cave/cmd_info.cc
index e193b372d..6a722a044 100644
--- a/src/clients/cave/cmd_info.cc
+++ b/src/clients/cave/cmd_info.cc
@@ -154,11 +154,10 @@ namespace
{
cout << fuc(fs_metadata_subsection(), fv<'i'>(std::string(indent, ' ')), fv<'s'>(k.human_name()));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(k.begin_metadata(), k.end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- s(keys.begin()), s_end(keys.end()) ; s != s_end ; ++s)
+ for (const auto & key : keys)
{
InfoDisplayer i(env, cmdline, indent + 1);
- (*s)->accept(i);
+ key->accept(i);
}
}
@@ -293,14 +292,13 @@ namespace
{
cout << fuc(fs_repository_heading(), fv<'s'>(stringify(repo->name())));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(repo->begin_metadata(), repo->end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)
+ for (const auto & key : keys)
{
- if ((*k)->type() == mkt_internal)
+ if (key->type() == mkt_internal)
continue;
InfoDisplayer i(env.get(), cmdline, 1);
- (*k)->accept(i);
+ key->accept(i);
}
cout << endl;
}
@@ -311,14 +309,13 @@ namespace
{
cout << fuc(fs_heading(), fv<'s'>("Environment Information"));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(env->begin_metadata(), env->end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)
+ for (const auto & key : keys)
{
- if ((*k)->type() == mkt_internal)
+ if (key->type() == mkt_internal)
continue;
InfoDisplayer i(env.get(), cmdline, 1);
- (*k)->accept(i);
+ key->accept(i);
}
cout << endl;
}
@@ -330,14 +327,13 @@ namespace
cout << fuc(fs_heading(), fv<'s'>("Package Manager Information"));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(AboutMetadata::get_instance()->begin_metadata(),
AboutMetadata::get_instance()->end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)
+ for (const auto & key : keys)
{
- if ((*k)->type() == mkt_internal)
+ if (key->type() == mkt_internal)
continue;
InfoDisplayer i(env.get(), cmdline, 1);
- (*k)->accept(i);
+ key->accept(i);
}
cout << endl;
}
diff --git a/src/clients/cave/cmd_print_unmanaged_files.cc b/src/clients/cave/cmd_print_unmanaged_files.cc
index 1fe8772cd..ce27736e8 100644
--- a/src/clients/cave/cmd_print_unmanaged_files.cc
+++ b/src/clients/cave/cmd_print_unmanaged_files.cc
@@ -208,9 +208,8 @@ PrintUnmanagedFilesCommand::run(const std::shared_ptr<Environment> & env,
std::inserter(unmanaged_files, unmanaged_files.begin()),
FSPathComparator());
- for (auto entry(unmanaged_files.begin()), end(unmanaged_files.end());
- entry != end; ++entry)
- cout << *entry << endl;
+ for (const auto & unmanaged_file : unmanaged_files)
+ cout << unmanaged_file << endl;
return EXIT_SUCCESS;
}
diff --git a/src/clients/cave/cmd_print_unused_distfiles.cc b/src/clients/cave/cmd_print_unused_distfiles.cc
index c459938a9..08af2718c 100644
--- a/src/clients/cave/cmd_print_unused_distfiles.cc
+++ b/src/clients/cave/cmd_print_unused_distfiles.cc
@@ -164,10 +164,9 @@ PrintUnusedDistfilesCommand::run(
selections.push_back(selection::AllVersionsUnsorted(generator::InRepository(RepositoryName(*c))));
std::set<std::shared_ptr<const PackageID>, PackageIDComparator> already_done((PackageIDComparator(env.get())));
- for (auto s(selections.begin()), s_end(selections.end()) ;
- s != s_end ; ++s)
+ for (auto & selection : selections)
{
- auto ids((*env)[*s]);
+ auto ids((*env)[selection]);
for (PackageIDSequence::ConstIterator iter(ids->begin()), end(ids->end()) ;
iter != end ; ++iter)
@@ -205,9 +204,9 @@ PrintUnusedDistfilesCommand::run(
// Iterate through the distdirs and compare their contents with the used distfiles
//
- for (auto dir(distdirs.begin()), d_end(distdirs.end()) ; dir != d_end ; ++dir)
+ for (const auto & distdir : distdirs)
{
- for (FSIterator file(*dir, {fsio_include_dotfiles, fsio_want_regular_files}), f_end ;
+ for (FSIterator file(distdir, {fsio_include_dotfiles, fsio_want_regular_files}), f_end ;
file != f_end ; ++file)
{
if (used_distfiles.find(file->basename()) == used_distfiles.end())
diff --git a/src/clients/cave/cmd_show.cc b/src/clients/cave/cmd_show.cc
index 052c449f5..8fb2b6e74 100644
--- a/src/clients/cave/cmd_show.cc
+++ b/src/clients/cave/cmd_show.cc
@@ -439,13 +439,12 @@ namespace
fv<'i'>(std::string(indent, ' ')));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(k.begin_metadata(), k.end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- s(keys.begin()), s_end(keys.end()) ; s != s_end ; ++s)
+ for (const auto & key : keys)
{
InfoDisplayer i(env, cmdline, basic_ppos, indent + 1,
- ((*s)->type() == mkt_significant), maybe_current_id, maybe_old_id, old_id_is_installed, out);
- if (want_key(cmdline, *s, maybe_current_id))
- accept_visitor(i)(**s);
+ (key->type() == mkt_significant), maybe_current_id, maybe_old_id, old_id_is_installed, out);
+ if (want_key(cmdline, key, maybe_current_id))
+ accept_visitor(i)(*key);
}
}
@@ -1073,12 +1072,11 @@ namespace
const std::shared_ptr<const Repository> repo(env->fetch_repository(s));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(repo->begin_metadata(), repo->end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)
+ for (const auto & key : keys)
{
- InfoDisplayer i(env, cmdline, basic_ppos, 0, ((*k)->type() == mkt_significant), nullptr, nullptr, false, cout);
- if (want_key(cmdline, *k, nullptr))
- accept_visitor(i)(**k);
+ InfoDisplayer i(env, cmdline, basic_ppos, 0, (key->type() == mkt_significant), nullptr, nullptr, false, cout);
+ if (want_key(cmdline, key, nullptr))
+ accept_visitor(i)(*key);
}
cout << endl;
}
@@ -1107,13 +1105,12 @@ namespace
out << fuc(fs_package_id_heading(), fv<'s'>(stringify(*best)), fv<'t'>(in_sets));
std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator> keys(best->begin_metadata(), best->end_metadata());
- for (std::set<std::shared_ptr<const MetadataKey>, MetadataKeyComparator>::const_iterator
- k(keys.begin()), k_end(keys.end()) ; k != k_end ; ++k)
+ for (const auto & key : keys)
{
- bool explicit_key(cmdline.a_key.end_args() != std::find(cmdline.a_key.begin_args(), cmdline.a_key.end_args(), (*k)->raw_name()));
- InfoDisplayer i(env, cmdline, basic_ppos, 0, ((*k)->type() == mkt_significant) || explicit_key, best, maybe_old_id, old_id_is_installed, out);
- if (want_key(cmdline, *k, best))
- accept_visitor(i)(**k);
+ bool explicit_key(cmdline.a_key.end_args() != std::find(cmdline.a_key.begin_args(), cmdline.a_key.end_args(), key->raw_name()));
+ InfoDisplayer i(env, cmdline, basic_ppos, 0, (key->type() == mkt_significant) || explicit_key, best, maybe_old_id, old_id_is_installed, out);
+ if (want_key(cmdline, key, best))
+ accept_visitor(i)(*key);
}
if (best->masked())
@@ -1182,16 +1179,15 @@ namespace
if (! best_installable)
best_installable = best_not_installed;
- for (std::set<RepositoryName>::const_iterator r(repos.begin()), r_end(repos.end()) ;
- r != r_end ; ++r)
+ for (const auto & r : repos)
{
- header_out << fuc(fs_package_repository(), fv<'s'>(stringify(*r)));
+ header_out << fuc(fs_package_repository(), fv<'s'>(stringify(r)));
std::string slot_name;
bool need_space(false);
for (PackageIDSequence::ConstIterator i(ids->begin()), i_end(ids->end()) ;
i != i_end ; ++i)
{
- if ((*i)->repository_name() != *r)
+ if ((*i)->repository_name() != r)
continue;
if (slot_name != slot_as_string(*i))
@@ -1295,10 +1291,10 @@ namespace
std::stringstream rest_out;
- for (auto r(repos.begin()), r_end(repos.end()) ; r != r_end ; ++r)
+ for (const auto & repo : repos)
{
auto r_ids((*env)[selection::AllVersionsGroupedBySlot(generator::Matches(
- PartiallyMadePackageDepSpec(s).in_repository(*r), nullptr, { }))]);
+ PartiallyMadePackageDepSpec(s).in_repository(repo), nullptr, { }))]);
if (! r_ids->empty())
do_one_package_with_ids(cmdline, env, basic_ppos, s, r_ids, cout, rest_out);
}
diff --git a/src/clients/cave/cmd_sync.cc b/src/clients/cave/cmd_sync.cc
index 8d8e564b1..2395b0ae5 100644
--- a/src/clients/cave/cmd_sync.cc
+++ b/src/clients/cave/cmd_sync.cc
@@ -315,10 +315,9 @@ namespace
{
Executor executor;
- for (Repos::const_iterator r(repos.begin()), r_end(repos.end()) ;
- r != r_end ; ++r)
+ for (const auto & repo : repos)
{
- const std::shared_ptr<SyncExecutive> x(std::make_shared<SyncExecutive>(env, cmdline, &executor, *r));
+ const std::shared_ptr<SyncExecutive> x(std::make_shared<SyncExecutive>(env, cmdline, &executor, repo));
executor.add(x);
executives.push_back(x);
}
diff --git a/src/clients/cave/resolve_common.cc b/src/clients/cave/resolve_common.cc
index fe1cb8f51..830cf444c 100644
--- a/src/clients/cave/resolve_common.cc
+++ b/src/clients/cave/resolve_common.cc
@@ -608,25 +608,24 @@ namespace
std::cout << "Dumping restarts:" << std::endl << std::endl;
- for (std::list<SuggestRestart>::const_iterator r(restarts.begin()), r_end(restarts.end()) ;
- r != r_end ; ++r)
+ for (const auto & restart : restarts)
{
- std::cout << "* " << r->resolvent() << std::endl;
+ std::cout << "* " << restart.resolvent() << std::endl;
std::cout << " Had decided upon ";
- auto c(get_decided_id_or_null(r->previous_decision()));
+ auto c(get_decided_id_or_null(restart.previous_decision()));
if (c)
std::cout << *c;
else
- std::cout << r->previous_decision()->accept_returning<std::string>(KindNameVisitor());
+ std::cout << restart.previous_decision()->accept_returning<std::string>(KindNameVisitor());
std::cout << std::endl;
- std::cout << " Which did not satisfy " << r->problematic_constraint()->spec()
- << ", use existing " << r->problematic_constraint()->use_existing();
- if (r->problematic_constraint()->nothing_is_fine_too())
+ std::cout << " Which did not satisfy " << restart.problematic_constraint()->spec()
+ << ", use existing " << restart.problematic_constraint()->use_existing();
+ if (restart.problematic_constraint()->nothing_is_fine_too())
std::cout << ", nothing is fine too";
- std::cout << " " << r->problematic_constraint()->reason()->accept_returning<std::string>(ShortReasonName());
+ std::cout << " " << restart.problematic_constraint()->reason()->accept_returning<std::string>(ShortReasonName());
std::cout << std::endl;
}