Browse Source

feature(shared_ptr): add make_shared();

TODO: make_shared should allocate memory only once
greatbridf 11 tháng trước cách đây
mục cha
commit
cb12970934
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 5 5
      gblibstdc++/include/memory

+ 5 - 5
gblibstdc++/include/memory

@@ -606,11 +606,11 @@ public:
 };
 
 // TODO: use only one allocation
-// template <typename T, typename... Args>
-// std::shared_ptr<T> make_shared(Args&&... args)
-// {
-//     return std::shared_ptr<T>(new T(std::forward<Args>(args)...));
-// }
+template <typename T, typename... Args>
+std::shared_ptr<T> make_shared(Args&&... args)
+{
+    return std::shared_ptr<T>(new T(std::forward<Args>(args)...));
+}
 
 } // namespace std