为什么ranges :: split_view不是双向范围
Why is ranges::split_view not a Bidirectional Range?
我正在使用cmcstl2库,其中c 提出的范围为gcc 8
std::string text = "Let me split this into words";
std::string pattern = " ";
auto splitText = text | ranges::view::split(pattern) |
ranges::view::reverse;
,但这不起作用,因为该视图只是一个向前范围而不是范围要求的双向范围(我认为这是发生的)。为什么?如果
text | ranges::view::split(pattern)
输出子弹视图。那视图不能逆转吗?
也必须在CMCSTL2中进行以下操作才能将其打印出来。
for (auto x : splitText)
{
for (auto m : x)
std::cout << m;
std::cout << " ";
}
,但在范围V3/0.4.0版本中我可以做:
for (auto x : splitText)
std::cout << x << 'n';
为什么?X的类型是什么?
编写的方式仅支持向前。
,您当然可以尝试制作双向Alange版本,尽管我怀疑这很难或不到一般。
考虑如何指定pattern
的所有选项,以便它也可以向后匹配。
相关文章:
- 为什么在全局范围内使用"extern int a"似乎不行?
- 尝试通过多个向量访问变量时,向量下标超出范围
- 错误:未在此范围内声明'reverse'
- 正在将指针转换为范围
- 使用std::transform将一个范围的元素添加到另一个范围中
- 在基于范围的for循环中使用结构化绑定声明
- 如何计算数据类型的范围,例如int
- 为什么 const std::p air<K,V>& 在 std::map 上基于范围的 for 循环不起作用?
- 在C++中查找范围的长度
- 如何设置一个范围来提取我想要获得的信息
- 并行用于C++17中数组索引范围内的循环
- 为左值和右值的包装器实现C++范围
- 求出有多少个数字是完美平方,而sqrt()是L,R范围内的素数
- 关于:C++中异常对象的范围:为什么我没有得到副本?
- 超出范围时使用对象
- 不计算一个范围内的完美数
- ";结果类型必须是可从输入范围的值类型""构造的;创建std::vector时
- 基于范围的 for 循环:迭代使用一个元素扩展的向量
- 如何从未知视图中声明范围::v3::View 变量
- 范围中的"range"和"view"有什么区别sv3 ts?