Skip to content

Commit

Permalink
Use reverse iterator for 5-star adv. because ranges are broken in clang
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Dec 15, 2022
1 parent 9d14a54 commit 8160cb6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/src/calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,22 @@ QSet<QString> Calculator::scoringRoundTieReduction(const QSet<QString>& tiedCand
* just taking Mandy and then restarting.
*/
QSet<QString> fiveStarAdv;
for(const Rank& r : fiveStarRankings | std::views::reverse)

/* for(const Rank& r : fiveStarRankings | std::views::reverse)
*
* Ranges are broken in clang and the fix likely won't be available until clang16 (long time till that becomes standard)
*
* https://github.com/llvm/llvm-project/issues/44178
*/
for(auto rItr = fiveStarRankings.crbegin(); rItr != fiveStarRankings.crend(); rItr++)
{
qsizetype room = candidatesNeeded - fiveStarAdv.size();

if(room == 0)
break;

if(r.candidates.size() <= room)
fiveStarAdv.unite(r.candidates);
if(rItr->candidates.size() <= room)
fiveStarAdv.unite(rItr->candidates);
else
break;
}
Expand Down

0 comments on commit 8160cb6

Please sign in to comment.