相关疑难解决方法(0)

C++20 std::ranges::sort 应该不需要支持 std::vector<bool> 吗?

我注意到std::ranges::sort无法排序std::vector<bool>

<source>:6:51: error: no match for call to '(const std::ranges::__sort_fn) (std::vector<bool, std::allocator<bool> >)'
6 |   std::ranges::sort(std::vector{false, true, true});
  |   
Run Code Online (Sandbox Code Playgroud)

这是允许的吗?我们是否需要专门化std::ranges::sortfor std::vector<bool>?是否有关于委员会如何考虑这一点的任何信息?

c++ stdvector c++20 std-ranges

10
推荐指数
1
解决办法
510
查看次数

标签 统计

c++ ×1

c++20 ×1

std-ranges ×1

stdvector ×1