diff --git a/4.SmartPointers/item18.md b/4.SmartPointers/item18.md index 7abd057..6cf2386 100644 --- a/4.SmartPointers/item18.md +++ b/4.SmartPointers/item18.md @@ -31,14 +31,14 @@ ```cpp class Investment { ... }; -class Sock: public Investment {...}; +class Stock: public Investment {...}; class Bond: public Investment {...}; class RealEstate: public Investment {...}; ``` ```mermaid classDiagram - Investment <|-- Sock + Investment <|-- Stock Investment <|-- Bond Investment <|-- RealEstate ``` @@ -121,7 +121,7 @@ makeInvestment(Ts&& params) ```cpp template -makeInvestment(Ts&& params) +auto makeInvestment(Ts&& params) { auto delInvmt = [](Investment* pInvestment) { @@ -187,4 +187,4 @@ std::shared_ptr sp = makeInvestment(arguments); - `std::unique_ptr`是轻量级、快速的、只能move的管理专有所有权语义资源的智能指针 - 默认情况,资源销毁通过delete,但是支持自定义delete函数。有状态的删除器和函数指针会增加`std::unique_ptr`的大小 -- 将`std::unique_ptr`转化为`std::shared_ptr`是简单的 \ No newline at end of file +- 将`std::unique_ptr`转化为`std::shared_ptr`是简单的