ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
make_unique.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
6
7#ifndef MAKE_UNIQUE_H
8#define MAKE_UNIQUE_H
9
10#if (!defined(_MSC_VER) && __cplusplus < 201402L)
11// std::make_unique reference implementation for linux c++11 mode compilers
12
13#include <cstddef>
14#include <memory>
15#include <type_traits>
16#include <utility>
17
18namespace std
19{
20template <class T>
22{
23 typedef unique_ptr<T> _Single_object;
24};
25
26template <class T>
27struct _Unique_if<T[]>
28{
29 typedef unique_ptr<T[]> _Unknown_bound;
30};
31
32template <class T, size_t N>
33struct _Unique_if<T[N]>
34{
35 typedef void _Known_bound;
36};
37
38template <class T, class... Args>
40{
41 return unique_ptr<T>(new T(std::forward<Args>(args)...));
42}
43
44template <class T>
46{
47 typedef typename remove_extent<T>::type U;
48 return unique_ptr<T>(new U[n]());
49}
50
51template <class T, class... Args>
52typename _Unique_if<T>::_Known_bound make_unique(Args &&...) = delete;
53} // namespace std
54
55#endif
56
57#endif
STL namespace.
_Unique_if< T >::_Single_object make_unique(Args &&...args)
Definition make_unique.h:39
unique_ptr< T[]> _Unknown_bound
Definition make_unique.h:29
unique_ptr< T > _Single_object
Definition make_unique.h:23