Iota for less loops.
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user