Parcourir la source

feature(shared_ptr): add make_shared();

TODO: make_shared should allocate memory only once
greatbridf il y a 11 mois
Parent
commit
cb12970934
1 fichiers modifiés avec 5 ajouts et 5 suppressions
  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