well, the location sorter is better, but i don't understand why, kinda by accident, will try to figure it out

This commit is contained in:
Me
2022-08-04 16:45:12 +02:00
parent ca8427262d
commit fce1bcbece
3 changed files with 82 additions and 11 deletions

View File

@@ -24,8 +24,25 @@ bool compareLocationConfigs(const LocationConfig &a, const LocationConfig &b)
}
*/
/*
class spec_int
{
public:
spec_int() {}
spec_int(int i): i(i){}
~spec_int() {}
// spec_int(int start, int num)
// {
// }
int i;
bool operator<(const spec_int &a, const spec_int &b)
{
return (a.i < b.i);
}
}
*/
void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
{
@@ -135,6 +152,34 @@ void ConfigParser::_post_processing(std::vector<ServerConfig> *servers)
// std::reverse(it->locations.begin(), it->locations.end());
/*
// let's test sort
int myints[] = {32,71,12,45,26,80,53,33};
// std::vector<spec_int> myvector (myints, myints+8);
// std::vector<spec_int> myvector(10, 5);
std::vector<spec_int> myvector;
myvector.resize(6);
myvector[0].i = 32;
myvector[1].i = 71;
myvector[2].i = 12;
myvector[3].i = 45;
myvector[4].i = 26;
myvector[5].i = 80;
std::sort(myvector.begin(), myvector.end());
std::cout << "myvector contains:";
// for (std::vector<int>::iterator it=myvector.begin(); it!=myvector.end(); ++it)
for (std::vector<spec_int>::iterator it=myvector.begin(); it!=myvector.end(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
*/
++it;
}