boost中的range与slice函数简介

本文档介绍了Boost库中的Range和Slice概念。Range用于指定从起始到结束(不包含)的增量为1的元素序列,适用于向量和矩阵。Slice则更通用,允许指定步长,可以增加或减少,适用于创建向量和矩阵的切片。它们都遵循Reversible Container模型。
摘要由CSDN通过智能技术生成

1 Range<SizeType,DistanceType>

1.1 Description

The class range specifies a range of indicies. The range is a sequence of indices from a start value to stop value. The indices increase by one and exlude the stop value.range can therefore be used to specify ranges of elements from vectors and matrices.

1.2 Example
#include <boost/numeric/ublas/storage.hpp> //range可以确定一组下标的范围,其步长为1,没有办法人为改变。

int main () {
    using namespace boost::numeric::ublas;
    range r (0, 3);
    for (unsigned i = 0; i < r.size (); ++ i) {
        std::cout << r (i) << std::endl;
    }
}

1.3 Definition

Defined in the header storage.hpp.

1.4 Model of

Reversible Container.

1.5 Type requirements

None, except for those imposed by the requirements of ReversibleContainer.

1.6 Public base classes

None.

1.7 Members
Member Description
range (size_type start, size_type sto
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值