博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
std::slice
阅读量:4040 次
发布时间:2019-05-24

本文共 1344 字,大约阅读时间需要 4 分钟。

std::slice

class slice;
Valarray slice selector
This class represents a 
 slice selector. It does not contain nor refers to any element - it only describes a selection of elements to be used as an index in 
.
valarray slice is defined by a 
starting index, a 
size, and a 
stride.
The 
starting index (
) is the index of the first element in the selection.
The 
size (
) is the number of elements in the selection.
The 
stride (
) is the span that separates the elements selected.
Therefore, a slice with a stride higher than 1 does not select contiguous elements in the 
; For example, 
slice(3,4,5)selects the elements 3, 8, 13 and 18.

Member functions


Example

12345678910111213141516171819
// slice example#include 
// std::cout#include
// std::size_t#include
// std::valarray, std::sliceint main (){ std::valarray
foo (12); for (int i=0; i<12; ++i) foo[i]=i; std::valarray
bar = foo[std::slice(2,3,4)]; std::cout << "slice(2,3,4):"; for (std::size_t n=0; n
Output
slice(2,3,4): 2 6 10

转载地址:http://fjxdi.baihongyu.com/

你可能感兴趣的文章
【leetcode】Word Break(python)
查看>>
【leetcode】Candy(python)
查看>>
【leetcode】Clone Graph(python)
查看>>
【leetcode】Sum Root to leaf Numbers
查看>>
【leetcode】Pascal's Triangle II (python)
查看>>
java自定义容器排序的两种方法
查看>>
如何成为编程高手
查看>>
本科生的编程水平到底有多高
查看>>
AngularJS2中最基本的文件说明
查看>>
从头开始学习jsp(2)——jsp的基本语法
查看>>
使用与或运算完成两个整数的相加
查看>>
备忘:java中的递归
查看>>
DIV/CSS:一个贴在左上角的标签
查看>>
Solr及Spring-Data-Solr入门学习
查看>>
Vue组件
查看>>
python_time模块
查看>>
python_configparser(解析ini)
查看>>
selenium学习资料
查看>>
<转>文档视图指针互获
查看>>
从mysql中 导出/导入表及数据
查看>>