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

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

wants to merge 1 commit into from

Conversation

RichardcLee
Copy link

std::sort 确实不可以对 std::list 进行排序,但不代表 list 不可以排序,实际上 std::list 也提供了成员函数 sort(),可以对 list 进行排序。

std::sort 确实不可以对 std::list 进行排序,但不代表 list 不可以排序,实际上 std::list 也提供了成员函数 sort(),可以对 list 进行排序。
@@ -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就无法进行排序”这个单独拿出来看当然是不对的,这里不能断章取义。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants