diff --git a/stl/pointer.hpp b/stl/pointer.hpp index 5291bf9..e37ed9f 100644 --- a/stl/pointer.hpp +++ b/stl/pointer.hpp @@ -22,7 +22,8 @@ class SharedPtr { struct ControlBlock : STL_NS_IMPL::BaseControlBlock { Type value; - ControlBlock(Type value) : value(value) {} + template + ControlBlock(Args&&... args) : value(forward(args)...) {} void* get_value() const override { return const_cast(&value); } }; @@ -104,7 +105,8 @@ class SharedPtr { template SharedPtr make_shared(Args&&... args) { - return SharedPtr(new typename SharedPtr::ControlBlock(Type(forward(args)...))); + using Block = typename SharedPtr::ControlBlock; + return SharedPtr(new Block(forward(args)...)); } }