26void move(std::vector<T>& v,
size_t sourceIdx,
size_t targetIdx)
28 if (sourceIdx > targetIdx)
30 std::rotate(v.rend() -
static_cast<int64_t
>(sourceIdx) - 1,
31 v.rend() -
static_cast<int64_t
>(sourceIdx), v.rend() -
static_cast<int64_t
>(targetIdx));
35 std::rotate(v.begin() +
static_cast<int64_t
>(sourceIdx),
36 v.begin() +
static_cast<int64_t
>(sourceIdx) + 1, v.begin() +
static_cast<int64_t
>(targetIdx) + 1);
44template<
typename Scalar>
47 std::vector<Scalar> container;
48 container.reserve(
static_cast<size_t>(std::ceil((end - start) / stepSize)));
52 container.push_back(start);
std::vector< Scalar > genRangeVector(Scalar start, Scalar stepSize, Scalar end)
Returns a container filled with the given range.
Definition Vector.hpp:45
void move(std::vector< T > &v, size_t sourceIdx, size_t targetIdx)
Moves an element within a vector to a new position.
Definition Vector.hpp:26