diff --git a/common/make_unique.hpp b/common/make_unique.hpp index 18c1d4774e0041e6618e85f89a3f55b66927207b..aac18079eb0fe3ba6b15e8c52c08363cdd4c9b65 100644 --- a/common/make_unique.hpp +++ b/common/make_unique.hpp @@ -18,6 +18,8 @@ #pragma once +#include<memory> + namespace cta { /** @@ -28,8 +30,8 @@ namespace cta { * created on the heap and wrapped by an std::unique_ptr. * @return The std::unique_ptr. */ -template<typename T, typename... Ts> std::unique_ptr<T> make_unique(Tss&&... params) { - return std::unique_ptr<T>(new T(std::foward<Ts>(params)...)); +template<typename T, typename... Ts> std::unique_ptr<T> make_unique(Ts&&... params) { + return std::unique_ptr<T>(new T(std::forward<Ts>(params)...)); } } // namespace cta diff --git a/rdbms/ConnFactoryFactory.cpp b/rdbms/ConnFactoryFactory.cpp index eb9369026d15726e58d135756726df37f9cdd4a6..8ac30c63e6123af65b4180bfe08802df1971d201 100644 --- a/rdbms/ConnFactoryFactory.cpp +++ b/rdbms/ConnFactoryFactory.cpp @@ -17,6 +17,7 @@ */ #include "common/exception/Exception.hpp" +#include "common/make_unique.hpp" #include "rdbms/ConnFactoryFactory.hpp" #include "rdbms/OcciConnFactory.hpp" #include "rdbms/SqliteConnFactory.hpp" @@ -31,11 +32,11 @@ std::unique_ptr<ConnFactory> ConnFactoryFactory::create(const Login &login) { try { switch(login.dbType) { case rdbms::Login::DBTYPE_IN_MEMORY: - return std::unique_ptr<SqliteConnFactory>(new SqliteConnFactory(":memory:")); + return make_unique<SqliteConnFactory>(":memory:"); case rdbms::Login::DBTYPE_ORACLE: - return std::unique_ptr<OcciConnFactory>(new OcciConnFactory(login.username, login.password, login.database)); + return make_unique<OcciConnFactory>(login.username, login.password, login.database); case rdbms::Login::DBTYPE_SQLITE: - return std::unique_ptr<SqliteConnFactory>(new SqliteConnFactory(login.database)); + return make_unique<SqliteConnFactory>(login.database); case rdbms::Login::DBTYPE_NONE: throw exception::Exception("Cannot create a catalogue without a database type"); default: