remove util self-written make_unique and use C++14 stdlib make_uniqe

This commit is contained in:
Huyen Chau Nguyen
2016-10-14 16:11:49 +02:00
committed by Daniel J. H
parent ef1f14550f
commit d0c142b9c7
8 changed files with 20 additions and 71 deletions
+2 -2
View File
@@ -11,7 +11,6 @@
#include "extractor/raster_source.hpp"
#include "util/graph_loader.hpp"
#include "util/io.hpp"
#include "util/make_unique.hpp"
#include "util/name_table.hpp"
#include "util/range_table.hpp"
#include "util/simple_logger.hpp"
@@ -51,6 +50,7 @@
#include <type_traits>
#include <unordered_map>
#include <vector>
#include <memory>
namespace osrm
{
@@ -125,7 +125,7 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
util::SimpleLogger().Write() << "Threads: " << number_of_threads;
ExtractionContainers extraction_containers;
auto extractor_callbacks = util::make_unique<ExtractorCallbacks>(extraction_containers);
auto extractor_callbacks = std::make_unique<ExtractorCallbacks>(extraction_containers);
const osmium::io::File input_file(config.input_path.string());
osmium::io::Reader reader(input_file);
+2 -2
View File
@@ -10,7 +10,6 @@
#include "extractor/restriction_parser.hpp"
#include "util/exception.hpp"
#include "util/lua_util.hpp"
#include "util/make_unique.hpp"
#include "util/simple_logger.hpp"
#include "util/typedefs.hpp"
@@ -23,6 +22,7 @@
#include <tbb/parallel_for.h>
#include <sstream>
#include <memory>
namespace osrm
{
@@ -247,7 +247,7 @@ LuaScriptingContext &LuaScriptingEnvironment::GetLuaContext()
auto &ref = script_contexts.local(initialized);
if (!initialized)
{
ref = util::make_unique<LuaScriptingContext>();
ref = std::make_unique<LuaScriptingContext>();
InitContext(*ref);
}
luabind::set_pcall_callback(&luaErrorCallback);
+3 -2
View File
@@ -7,14 +7,15 @@
#include "engine/engine.hpp"
#include "engine/engine_config.hpp"
#include "engine/status.hpp"
#include "util/make_unique.hpp"
#include <memory>
namespace osrm
{
// Pimpl idiom
OSRM::OSRM(engine::EngineConfig &config) : engine_(util::make_unique<engine::Engine>(config)) {}
OSRM::OSRM(engine::EngineConfig &config) : engine_(std::make_unique<engine::Engine>(config)) {}
OSRM::~OSRM() = default;
OSRM::OSRM(OSRM &&) noexcept = default;
OSRM &OSRM::operator=(OSRM &&) noexcept = default;
+8 -7
View File
@@ -9,7 +9,8 @@
#include "server/api/parsed_url.hpp"
#include "util/json_util.hpp"
#include "util/make_unique.hpp"
#include <memory>
namespace osrm
{
@@ -17,12 +18,12 @@ namespace server
{
ServiceHandler::ServiceHandler(osrm::EngineConfig &config) : routing_machine(config)
{
service_map["route"] = util::make_unique<service::RouteService>(routing_machine);
service_map["table"] = util::make_unique<service::TableService>(routing_machine);
service_map["nearest"] = util::make_unique<service::NearestService>(routing_machine);
service_map["trip"] = util::make_unique<service::TripService>(routing_machine);
service_map["match"] = util::make_unique<service::MatchService>(routing_machine);
service_map["tile"] = util::make_unique<service::TileService>(routing_machine);
service_map["route"] = std::make_unique<service::RouteService>(routing_machine);
service_map["table"] = std::make_unique<service::TableService>(routing_machine);
service_map["nearest"] = std::make_unique<service::NearestService>(routing_machine);
service_map["trip"] = std::make_unique<service::TripService>(routing_machine);
service_map["match"] = std::make_unique<service::MatchService>(routing_machine);
service_map["tile"] = std::make_unique<service::TileService>(routing_machine);
}
engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url,
+1 -2
View File
@@ -4,7 +4,6 @@
#include "util/exception.hpp"
#include "util/fingerprint.hpp"
#include "util/graph_loader.hpp"
#include "util/make_unique.hpp"
#include "util/simple_logger.hpp"
#include "util/static_graph.hpp"
#include "util/typedefs.hpp"
@@ -125,7 +124,7 @@ int main(int argc, char *argv[])
osrm::util::SimpleLogger().Write() << "Starting SCC graph traversal";
auto tarjan =
osrm::util::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
std::make_unique<osrm::extractor::TarjanSCC<osrm::tools::TarjanGraph>>(graph);
tarjan->Run();
osrm::util::SimpleLogger().Write() << "identified: " << tarjan->GetNumberOfComponents()
<< " many components";
+2 -2
View File
@@ -1,5 +1,4 @@
#include "server/server.hpp"
#include "util/make_unique.hpp"
#include "util/simple_logger.hpp"
#include "util/version.hpp"
@@ -25,6 +24,7 @@
#include <new>
#include <string>
#include <thread>
#include <memory>
#ifdef _WIN32
boost::function0<void> console_ctrl_function;
@@ -318,7 +318,7 @@ int main(int argc, const char *argv[]) try
#endif
auto routing_server = server::Server::CreateServer(ip_address, ip_port, requested_thread_num);
auto service_handler = util::make_unique<server::ServiceHandler>(config);
auto service_handler = std::make_unique<server::ServiceHandler>(config);
routing_server->RegisterServiceHandler(std::move(service_handler));