C++/STL: std::transform with given stride?

后端 未结 4 791
既然无缘
既然无缘 2021-01-12 17:53

I have a 1d array containing Nd data, I would like to effectively traverse on it with std::transform or std::for_each.

unigned int nelems;
unsigned int strid         


        
4条回答
  •  没有蜡笔的小新
    2021-01-12 18:26

    use boost adapters. you can get iterators out of them. the only disadvantage is compilation time.

    vector pp = vector_load(pP);
    boost::for_each(pp|stride(3)|transformed(dosmtn()));
    

提交回复
热议问题