From d9f669e085438e33cde50f01029e1934b0c7006a Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 10 Sep 2018 16:19:06 +0200 Subject: [PATCH] now that we are on c++14 and std::make_unique is available everywhere, we can safely remove our shim for std::make_unique (#6429) --- lib/Basics/Common.h | 3 +- lib/Basics/make_unique.h | 81 ---------------------------------------- 2 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 lib/Basics/make_unique.h diff --git a/lib/Basics/Common.h b/lib/Basics/Common.h index e6aa4b007f..f5b0138b1e 100644 --- a/lib/Basics/Common.h +++ b/lib/Basics/Common.h @@ -171,7 +171,6 @@ typedef long suseconds_t; #include "Basics/voc-errors.h" #include "Basics/error.h" #include "Basics/debugging.h" -#include "Basics/make_unique.h" #include "Basics/memory.h" #include "Basics/system-compiler.h" #include "Basics/system-functions.h" @@ -259,4 +258,4 @@ inline void ADB_WindowsExitFunction(int, void*) {} #endif #define sleep ERROR_USE_std_this_thread_sleep_for -#endif \ No newline at end of file +#endif diff --git a/lib/Basics/make_unique.h b/lib/Basics/make_unique.h deleted file mode 100644 index c5f85ba2f6..0000000000 --- a/lib/Basics/make_unique.h +++ /dev/null @@ -1,81 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -/// DISCLAIMER -/// -/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany -/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany -/// -/// Licensed under the Apache License, Version 2.0 (the "License"); -/// you may not use this file except in compliance with the License. -/// You may obtain a copy of the License at -/// -/// http://www.apache.org/licenses/LICENSE-2.0 -/// -/// Unless required by applicable law or agreed to in writing, software -/// distributed under the License is distributed on an "AS IS" BASIS, -/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -/// See the License for the specific language governing permissions and -/// limitations under the License. -/// -/// Copyright holder is ArangoDB GmbH, Cologne, Germany -/// -/// @author Dr. Frank Celler -//////////////////////////////////////////////////////////////////////////////// - -#ifndef ARANGODB_BASICS_MAKE__UNIQUE_H -#define ARANGODB_BASICS_MAKE__UNIQUE_H 1 - -#include -#include -#include -#include - -// VS 2013 and VS 2015 already provide std::make_unique -#ifndef _WIN32 - -// c++98: 199711 (not supported) -// c++11: 201103 (no std::make_unique) -// c++14: 201402 (std::make_unique included) - -#if __cplusplus == 201103L - -//////////////////////////////////////////////////////////////////////////////// -/// Provide a make_unique() function for C++11 too -/// http://stackoverflow.com/questions/17902405/how-to-implement-make-unique-function-in-c11 -//////////////////////////////////////////////////////////////////////////////// - -namespace std { -template -struct _Unique_if { - typedef unique_ptr _Single_object; -}; - -template -struct _Unique_if { - typedef unique_ptr _Unknown_bound; -}; - -template -struct _Unique_if { - typedef void _Known_bound; -}; - -template -typename _Unique_if::_Single_object make_unique(Args&&... args) { - return unique_ptr(new T(std::forward(args)...)); -} - -template -typename _Unique_if::_Unknown_bound make_unique(size_t n) { - typedef typename remove_extent::type U; - return unique_ptr(new U[n]()); -} - -template -typename _Unique_if::_Known_bound make_unique(Args&&...) = delete; -} - -#endif - -#endif - -#endif