This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
static void formatValue(V&); | |
.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void saveIndex(Index const& index) | |
{ | |
if (index.hasID() && index.isQuoted() && index.isLiquid()) | |
{ | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void saveIndex(const Index& index) | |
{ | |
if (isValid(index)) | |
{ | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Location | |
{ | |
public: | |
double distanceTo(const Location& other) const; | |
... | |
}; | |
class GeographicalAttributes | |
{ | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int computeNumberOfBreaks(const std::vector<City>& route) | |
{ | |
static const double MaxDistance = 100; | |
int nbBreaks = 0; | |
for (std::vector<City>::const_iterator it1 = route.begin(), it2 = route.end(); | |
it1 != route.end(); | |
it2 = it1, ++it1) | |
{ | |
if (it2 != route.end()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (std::vector<City>::const_iterator it1 = route.begin(), it2 = route.end(); | |
it1 != route.end(); | |
it2 = it1, ++it1) | |
{ | |
if (it2 != route.end()) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it1->getGeographicalAttributes().getLocation().distanceTo( | |
it2->getGeographicalAttributes().getLocation()) > MaxDistance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int nbBreaks = 0; | |
for (...) | |
{ | |
if(...) | |
{ | |
++nbBreaks; | |
} | |
} | |
return nbBreaks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FartherThan | |
{ | |
public: | |
explicit FartherThan(double distance) : m_distance(distance) {} | |
bool operator()(const std::pair<City, City>& cities) | |
{ | |
return cities.first.getGeographicalAttributes().getLocation().distanceTo( | |
cities.second.getGeographicalAttributes().getLocation()) > m_distance; | |
} | |
private: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int computeNumberOfBreaks(const std::vector<City>& route) | |
{ | |
static const double MaxDistance = 100; | |
return count_if(consecutive(route), FartherThan(MaxDistance)); | |
} |
OlderNewer