Moved tagpair-lambda up for better readability.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b4fb62b15a
commit
da88eaf703
|
@ -183,7 +183,8 @@ namespace remwharead
|
|||
_out << "== Tags\n\n";
|
||||
vector<tagpair> sortedtags(tags.size());
|
||||
std::move(tags.begin(), tags.end(), sortedtags.begin());
|
||||
std::sort(sortedtags.begin(), sortedtags.end(),
|
||||
|
||||
const auto compare_tags =
|
||||
[](const tagpair &a, tagpair &b)
|
||||
{
|
||||
if (a.second.size() != b.second.size())
|
||||
|
@ -192,16 +193,17 @@ namespace remwharead
|
|||
}
|
||||
else
|
||||
{ // Sort by tag names otherwise.
|
||||
std::locale loc;
|
||||
const std::locale loc;
|
||||
const std::collate<char> &coll =
|
||||
std::use_facet<std::collate<char>>(loc);
|
||||
return (coll.compare(
|
||||
a.first.data(), a.first.data()
|
||||
+ a.first.length(),
|
||||
b.first.data(), b.first.data()
|
||||
+ b.first.length()) == -1);
|
||||
return (
|
||||
coll.compare(
|
||||
a.first.data(), a.first.data() + a.first.length(),
|
||||
b.first.data(), b.first.data() + b.first.length())
|
||||
== -1);
|
||||
}
|
||||
});
|
||||
};
|
||||
std::sort(sortedtags.begin(), sortedtags.end(), compare_tags);
|
||||
|
||||
bool othertags = false; // Have we printed “Less used tags” already?
|
||||
for (const auto &tag : sortedtags)
|
||||
|
|
Loading…
Reference in New Issue