@@ -102,11 +102,25 @@ struct make_unique_impl<T&&> {};
102
102
template <typename T,
103
103
typename ... Args,
104
104
typename Impl = detail::make_unique_impl<T>,
105
- typename = decltype (Impl::make(std::true_type{}, std::declval<Args>()...))>
105
+ typename std::enable_if<!std::is_array<T>::value,
106
+ decltype (Impl::make(std::true_type{}, std::declval<Args>()...),
107
+ void ())>::type* = nullptr >
106
108
std::unique_ptr<T> make_unique (Args&&... args) {
107
109
return Impl::make (std::true_type{}, std::forward<Args>(args)...);
108
110
}
109
111
112
+ /* *
113
+ * @copydoc bsoncxx::v_noabi::stdx::make_unique
114
+ */
115
+ template <typename T,
116
+ typename Impl = detail::make_unique_impl<T>,
117
+ typename std::enable_if<std::is_array<T>::value,
118
+ decltype (Impl::make(std::true_type{}, std::declval<std::size_t >()),
119
+ void ())>::type* = nullptr >
120
+ std::unique_ptr<T> make_unique (std::size_t count) {
121
+ return Impl::make (std::true_type{}, count);
122
+ }
123
+
110
124
/* *
111
125
* @brief Create a new std::unique_ptr that points-to a default-initialized instance of the given
112
126
* type.
@@ -125,11 +139,25 @@ std::unique_ptr<T> make_unique(Args&&... args) {
125
139
template <typename T,
126
140
typename ... Args,
127
141
typename Impl = detail::make_unique_impl<T>,
128
- typename = decltype (Impl::make(std::false_type{}, std::declval<Args>()...))>
142
+ typename std::enable_if<!std::is_array<T>::value,
143
+ decltype (Impl::make(std::false_type{}, std::declval<Args>()...),
144
+ void ())>::type* = nullptr >
129
145
std::unique_ptr<T> make_unique_for_overwrite (Args&&... args) {
130
146
return Impl::make (std::false_type{}, std::forward<Args>(args)...);
131
147
}
132
148
149
+ /* *
150
+ * @copydoc bsoncxx::v_noabi::stdx::make_unique_for_overwrite
151
+ */
152
+ template <typename T,
153
+ typename Impl = detail::make_unique_impl<T>,
154
+ typename std::enable_if<std::is_array<T>::value,
155
+ decltype (Impl::make(std::false_type{}, std::declval<std::size_t >()),
156
+ void ())>::type* = nullptr >
157
+ std::unique_ptr<T> make_unique_for_overwrite (std::size_t count) {
158
+ return Impl::make (std::false_type{}, count);
159
+ }
160
+
133
161
} // namespace stdx
134
162
BSONCXX_INLINE_NAMESPACE_END
135
163
} // namespace bsoncxx
0 commit comments