Iota for less loops.
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <numeric>
|
||||||
|
|
||||||
#include "../gamestr.h"
|
#include "../gamestr.h"
|
||||||
#include "../starmap.h"
|
#include "../starmap.h"
|
||||||
@@ -50,12 +51,11 @@ compStarName (const int index1, const int index2)
|
|||||||
static void
|
static void
|
||||||
SortStarsOnName (STAR_SEARCH_STATE *pSS)
|
SortStarsOnName (STAR_SEARCH_STATE *pSS)
|
||||||
{
|
{
|
||||||
std::cerr << "ADAM C++: Star sorting!" << std::endl;
|
//std::cerr << "ADAM C++: Star sorting!" << std::endl;
|
||||||
int i;
|
|
||||||
int *sorted = pSS->SortedStars;
|
int *sorted = pSS->SortedStars;
|
||||||
|
|
||||||
for (i = 0; i < GetStarCount(); i++)
|
std::iota( sorted, sorted + GetStarCount(), 0 );
|
||||||
sorted[i] = i;
|
|
||||||
|
|
||||||
std::sort( sorted, sorted + GetStarCount(), compStarName );
|
std::sort( sorted, sorted + GetStarCount(), compStarName );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user