Slicing a vector in C++

后端 未结 4 496
执念已碎
执念已碎 2020-12-29 01:54

Is there an equivalent of list slicing [1:] from Python in C++ with vectors? I simply want to get all but the first element from a vector.

Python\'s lis

4条回答
  •  死守一世寂寞
    2020-12-29 02:39

    It seems that the cheapest way is to use pointer to the starting element and the number of elements in the slice. It would not be a real vector but it will be good enough for many uses.

提交回复
热议问题