From 53be2aa45719afd8a1cc2e1cb98cf79ed33d7154 Mon Sep 17 00:00:00 2001 From: Chenzs108 Date: Sun, 26 Dec 2021 14:59:06 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E5=AD=97?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Chapter-10 Generic Algorithms/README.md | 10 +++++----- Chapter-13 Copy Control/README.md | 3 +-- Chapter-16 Templates and Generic Programming/README.md | 2 +- Chapter-19 Specialized Tools and Techniques/README.md | 2 +- README.md | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Chapter-10 Generic Algorithms/README.md b/Chapter-10 Generic Algorithms/README.md index 852b280..9797e62 100644 --- a/Chapter-10 Generic Algorithms/README.md +++ b/Chapter-10 Generic Algorithms/README.md @@ -302,12 +302,12 @@ for_each(words.begin(), words.end(), bind(print, ref(os), _1, ' ')); - `inserter`:创建一个调用`insert`操作的迭代器。此函数接受第二个参数,该参数必须是一个指向给定容器的迭代器,元素会被插入到该参数指向的元素之前。 ```c++ -list 1st = { 1,2,3,4 }; +list lst = { 1,2,3,4 }; list lst2, lst3; // empty lists -// after copy completes, 1st2 contains 4 3 2 1 -copy(1st.cbegin(), lst.cend(), front_inserter(lst2)); -// after copy completes, 1st3 contains 1 2 3 4 -copy(1st.cbegin(), lst.cend(), inserter(lst3, lst3.begin())); +// after copy completes, lst2 contains 4 3 2 1 +copy(lst.cbegin(), lst.cend(), front_inserter(lst2)); +// after copy completes, lst3 contains 1 2 3 4 +copy(lst.cbegin(), lst.cend(), inserter(lst3, lst3.begin())); ``` ### iostream迭代器(iostream Iterators) diff --git a/Chapter-13 Copy Control/README.md b/Chapter-13 Copy Control/README.md index 1cfc5b9..4208eb5 100644 --- a/Chapter-13 Copy Control/README.md +++ b/Chapter-13 Copy Control/README.md @@ -109,8 +109,7 @@ Sales_data& Sales_data::operator=(const Sales_data &rhs) { bookNo = rhs.bookNo; // calls the string::operator= units_sold = rhs.units_sold; // uses the built-in int assignment - revenue = rhs.revenue; // uses the built-in double - assignment + revenue = rhs.revenue; // uses the built-in double assignment return *this; // return a reference to this object } ``` diff --git a/Chapter-16 Templates and Generic Programming/README.md b/Chapter-16 Templates and Generic Programming/README.md index 426aba5..94b9d4e 100644 --- a/Chapter-16 Templates and Generic Programming/README.md +++ b/Chapter-16 Templates and Generic Programming/README.md @@ -650,7 +650,7 @@ s2 = std::move(s1); // ok: but after the assigment s1 has indeterminate valu - `remove_reference`用`string&`进行实例化。 - `remove_reference`的`type`成员是`string`。 - `move`的返回类型是`string&&`。 - - `move`的函数参数t的类型为`string& &&`,会折叠成`string&`。 + - `move`的函数参数*t*的类型为`string& &&`,会折叠成`string&`。 可以使用`static_cast`显式地将一个左值转换为一个右值引用。 diff --git a/Chapter-19 Specialized Tools and Techniques/README.md b/Chapter-19 Specialized Tools and Techniques/README.md index 03915b8..1676584 100644 --- a/Chapter-19 Specialized Tools and Techniques/README.md +++ b/Chapter-19 Specialized Tools and Techniques/README.md @@ -162,7 +162,7 @@ dynamic_cast(e) 通常情况下,`typeid`用于比较两条表达式的类型是否相同,或者比较一条表达式的类型是否与指定类型相同。 ```c++ -C++Derived *dp = new Derived; +Derived *dp = new Derived; Base *bp = dp; // both pointers point to a Derived object // compare the type of two objects at run time if (typeid(*bp) == typeid(*dp)) diff --git a/README.md b/README.md index c6d3f2f..4a16038 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,6 @@ ## 关于 -***GitHub***:https://github.com/czs108/ +***GitHub***:https://github.com/czs108 ***E-Mail***:chenzs108@outlook.com \ No newline at end of file