diff options
author | Mikhail Gorbushin <m.gorbushin@corp.mail.ru> | 2019-05-08 18:15:28 +0300 |
---|---|---|
committer | Vlad Mihaylenko <vxmihaylenko@gmail.com> | 2019-05-14 17:53:33 +0300 |
commit | 8a2e3eafa924b997c7d76c9cade91f647c019ac3 (patch) | |
tree | 7d90c124551820ca59f2891f95949df94806c77b /routing | |
parent | b166754ecf604078fb1f067b97cae0b366c9f158 (diff) |
[routing] remove template without bug
Diffstat (limited to 'routing')
-rw-r--r-- | routing/routing_integration_tests/routing_test_tools.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp index ef2a0018a4..4e00fe34a5 100644 --- a/routing/routing_integration_tests/routing_test_tools.cpp +++ b/routing/routing_integration_tests/routing_test_tools.cpp @@ -33,8 +33,10 @@ #include <functional> #include <limits> +#include <map> #include <memory> #include <sys/resource.h> +#include <tuple> using namespace routing; using namespace routing_test; @@ -149,9 +151,14 @@ shared_ptr<VehicleRouterComponents> CreateAllMapsComponents(VehicleType vehicleT IRouterComponents & GetVehicleComponents(VehicleType vehicleType) { - static auto const instance = CreateAllMapsComponents(vehicleType); - ASSERT(instance, ()); - return *instance; + static map<VehicleType, shared_ptr<VehicleRouterComponents>> kVehicleComponents; + + auto it = kVehicleComponents.find(vehicleType); + if (it == kVehicleComponents.end()) + tie(it, ignore) = kVehicleComponents.emplace(vehicleType, CreateAllMapsComponents(vehicleType)); + + CHECK(it->second, ()); + return *(it->second); } TRouteResult CalculateRoute(IRouterComponents const & routerComponents, |