[core] Use constexpr when possible

Signed-off-by: x7z4w <x7z4w@noreply.codeberg.org>
This commit is contained in:
x7z4w
2025-10-24 08:36:38 +00:00
parent 936e05283c
commit 42f059f8f7
90 changed files with 258 additions and 259 deletions

View File

@@ -30,7 +30,7 @@ void FixupCarTurns(vector<RouteSegment> & routeSegments)
// (1) the route enters to the roundabout;
// (2) the route leaves the roundabout;
uint32_t exitNum = 0;
size_t const kInvalidEnter = numeric_limits<size_t>::max();
size_t constexpr kInvalidEnter = numeric_limits<size_t>::max();
size_t enterRoundAbout = kInvalidEnter;
for (size_t idx = 0; idx < routeSegments.size(); ++idx)

View File

@@ -86,7 +86,7 @@ size_t PedestrianDirectionsEngine::GetTurnDirection(IRoutingResult const & resul
void PedestrianDirectionsEngine::FixupTurns(vector<RouteSegment> & routeSegments)
{
double const kMergeDistMeters = 15.0;
double constexpr kMergeDistMeters = 15.0;
for (size_t idx = 0; idx < routeSegments.size(); ++idx)
{

View File

@@ -159,7 +159,7 @@ public:
}
private:
static uint32_t const kDefaultFeatureId = 0;
static uint32_t constexpr kDefaultFeatureId = 0;
/// \brief Serializes a range of restrictions form |begin| to |end| to |sink|.
/// \param begin is an iterator to the first item to serialize.

View File

@@ -7,8 +7,10 @@
namespace
{
using CountrySetT = std::unordered_set<std::string_view>;
// List of country names where mwm should be generated without speed cameras.
std::vector<std::string> kSpeedCamerasProhibitedCountries = {
CountrySetT kSpeedCamerasProhibitedCountries = {
"Germany",
"Macedonia",
"Switzerland",
@@ -17,11 +19,11 @@ std::vector<std::string> kSpeedCamerasProhibitedCountries = {
};
// List of country names where an end user should be warned about speed cameras.
std::vector<std::string> kSpeedCamerasPartlyProhibitedCountries = {
CountrySetT kSpeedCamerasPartlyProhibitedCountries = {
"France",
};
bool IsMwmContained(platform::CountryFile const & mwm, std::vector<std::string> const & countryList)
bool IsMwmContained(platform::CountryFile const & mwm, CountrySetT const & countryList)
{
return std::any_of(countryList.cbegin(), countryList.cend(),
[&mwm](auto const & country) { return mwm.GetName().starts_with(country); });

View File

@@ -4,7 +4,7 @@
namespace routing
{
std::string const kDebugSpeedCamSetting = "DebugSpeedCam";
std::string_view constexpr kDebugSpeedCamSetting = "DebugSpeedCam";
/// \returns true if any information about speed cameras is prohibited in |mwm|.
bool AreSpeedCamerasProhibited(platform::CountryFile const & mwm);