Skip to content

Commit 2bc624b

Browse files
committed
Take args parameter pack by forwarding reference
1 parent 7ec7dbb commit 2bc624b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/cpp2util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,20 +338,20 @@ auto assert_in_bounds(auto&& x, auto&& arg CPP2_SOURCE_LOCATION_PARAM_WITH_DEFAU
338338
//
339339
struct {
340340
template<typename T>
341-
[[nodiscard]] auto cpp2_new(auto ...args) const -> std::unique_ptr<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 {
347347
template<typename T>
348-
[[nodiscard]] auto cpp2_new(auto ...args) const -> std::shared_ptr<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

353353
template<typename T>
354-
[[nodiscard]] auto cpp2_new(auto ...args) -> std::unique_ptr<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)