mirror of https://gitee.com/bigwinds/arangodb
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)
This commit is contained in:
parent
173c78bb3b
commit
d9f669e085
|
@ -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
|
||||
#endif
|
||||
|
|
|
@ -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 <cstddef>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
// 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 <class T>
|
||||
struct _Unique_if {
|
||||
typedef unique_ptr<T> _Single_object;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct _Unique_if<T[]> {
|
||||
typedef unique_ptr<T[]> _Unknown_bound;
|
||||
};
|
||||
|
||||
template <class T, size_t N>
|
||||
struct _Unique_if<T[N]> {
|
||||
typedef void _Known_bound;
|
||||
};
|
||||
|
||||
template <class T, class... Args>
|
||||
typename _Unique_if<T>::_Single_object make_unique(Args&&... args) {
|
||||
return unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename _Unique_if<T>::_Unknown_bound make_unique(size_t n) {
|
||||
typedef typename remove_extent<T>::type U;
|
||||
return unique_ptr<T>(new U[n]());
|
||||
}
|
||||
|
||||
template <class T, class... Args>
|
||||
typename _Unique_if<T>::_Known_bound make_unique(Args&&...) = delete;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue