ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
etiss
include
etiss
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
18
namespace
std
19
{
20
template
<
class
T>
21
struct
_Unique_if
22
{
23
typedef
unique_ptr<T>
_Single_object
;
24
};
25
26
template
<
class
T>
27
struct
_Unique_if
<T[]>
28
{
29
typedef
unique_ptr<T[]>
_Unknown_bound
;
30
};
31
32
template
<
class
T,
size_t
N>
33
struct
_Unique_if
<T[N]>
34
{
35
typedef
void
_Known_bound
;
36
};
37
38
template
<
class
T,
class
... Args>
39
typename
_Unique_if<T>::_Single_object
make_unique
(Args &&...args)
40
{
41
return
unique_ptr<T>(
new
T(std::forward<Args>(args)...));
42
}
43
44
template
<
class
T>
45
typename
_Unique_if<T>::_Unknown_bound
make_unique
(
size_t
n)
46
{
47
typedef
typename
remove_extent<T>::type U;
48
return
unique_ptr<T>(
new
U[n]());
49
}
50
51
template
<
class
T,
class
... Args>
52
typename
_Unique_if<T>::_Known_bound
make_unique
(Args &&...) =
delete
;
53
}
// namespace std
54
55
#endif
56
57
#endif
std
STL namespace.
std::make_unique
_Unique_if< T >::_Single_object make_unique(Args &&...args)
Definition
make_unique.h:39
std::_Unique_if< T[N]>::_Known_bound
void _Known_bound
Definition
make_unique.h:35
std::_Unique_if< T[]>::_Unknown_bound
unique_ptr< T[]> _Unknown_bound
Definition
make_unique.h:29
std::_Unique_if
Definition
make_unique.h:22
std::_Unique_if::_Single_object
unique_ptr< T > _Single_object
Definition
make_unique.h:23
Generated on Sat Nov 15 2025 19:30:10 for ETISS 0.11.2 by
1.9.8