kopia lustrzana https://gitlab.com/tomaszg/geostat
Change raw loop to std::algorithm find_if
rodzic
3785d5d067
commit
397eaf415f
|
@ -4,6 +4,7 @@
|
|||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
@ -162,12 +163,8 @@ Caches Okapi::get_caches(const std::map<std::string, std::tm>& codes) const {
|
|||
c.set_date_hidden(tmp);
|
||||
|
||||
//ugly way to handle date... might produce bad results if a cache appears twice in the list
|
||||
for (auto& el2 : codes) {
|
||||
if (el2.first == c.code) {
|
||||
c.set_date(el2.second);
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto el2 = std::find_if( codes.begin(), codes.end(), [&](auto& e) { return e.first == c.code; });
|
||||
c.set_date(el2->second);
|
||||
cc.insert(c);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue