Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

纠正一个错误的描述。 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion content/chapter2/chapter2-4-chinese.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ void insert_sorted(C &v, const T &item)
}
```

当我们要将`std::vector`类型转换为其他类型时,需要注意的是并不是所有容器都支持`std::sort`。该函数所对应的算法需要容器为可随机访问容器,例如`std::list`就无法进行排序。
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句话结合上下文看是没有问题的。“std::list就无法进行排序”这个单独拿出来看当然是不对的,这里不能断章取义。

当我们要将`std::vector`类型转换为其他类型时,需要注意的是并不是所有容器都支持`std::sort`。该函数所对应的算法需要容器为可随机访问容器,例如`std::list`就无法用`std::sort`进行排序。
不过,`std::list`可以使用成员函数`sort`进行排序。