Iota for less loops.

This commit is contained in:
2024-04-24 21:22:25 -04:00
parent 17c8c9aed4
commit 93cd0f7324
+4 -4
View File
@@ -23,6 +23,7 @@
#include <memory>
#include <algorithm>
#include <iostream>
#include <numeric>
#include "../gamestr.h"
#include "../starmap.h"
@@ -50,12 +51,11 @@ compStarName (const int index1, const int index2)
static void
SortStarsOnName (STAR_SEARCH_STATE *pSS)
{
std::cerr << "ADAM C++: Star sorting!" << std::endl;
int i;
//std::cerr << "ADAM C++: Star sorting!" << std::endl;
int *sorted = pSS->SortedStars;
for (i = 0; i < GetStarCount(); i++)
sorted[i] = i;
std::iota( sorted, sorted + GetStarCount(), 0 );
std::sort( sorted, sorted + GetStarCount(), compStarName );
}