Skip to content

Commit 510489b

Browse files
authored
Merge pull request #129 from gerlero/cpp2_new
[FIX] Fix declarations of cpp2_new
2 parents 0304b4a + 2bc624b commit 510489b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/cpp2util.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,21 +337,21 @@ auto assert_in_bounds(auto&& x, auto&& arg CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAU
337337
//-----------------------------------------------------------------------
338338
//
339339
struct {
340-
template<typename T, typename... Args>
341-
[[nodiscard]] auto cpp2_new(auto ...args) const -> std::unique_ptr<T> {
340+
template<typename T>
341+
[[nodiscard]] auto cpp2_new(auto&& ...args) const -> std::unique_ptr<T> {
342342
return std::make_unique<T>(std::forward<decltype(args)>(args)...);
343343
}
344344
} unique;
345345

346346
struct {
347-
template<typename T, typename... Args>
348-
[[nodiscard]] auto cpp2_new(auto ...args) const -> std::shared_ptr<T> {
347+
template<typename T>
348+
[[nodiscard]] auto cpp2_new(auto&& ...args) const -> std::shared_ptr<T> {
349349
return std::make_shared<T>(std::forward<decltype(args)>(args)...);
350350
}
351351
} shared;
352352

353-
template<typename T, typename... Args>
354-
[[nodiscard]] auto cpp2_new(auto ...args) -> std::unique_ptr<T> {
353+
template<typename T>
354+
[[nodiscard]] auto cpp2_new(auto&& ...args) -> std::unique_ptr<T> {
355355
return std::make_unique<T>(std::forward<decltype(args)>(args)...);
356356
}
357357

0 commit comments

Comments
 (0)