Replaced hand-crafted reverse algorithm with std::reverse
This commit is contained in:
parent
ed970fe6f6
commit
1a2c5de357
|
@ -508,20 +508,11 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
||||||
template <class T>
|
template <class T>
|
||||||
QVector<T> VLayoutPiece::Map(QVector<T> points) const
|
QVector<T> VLayoutPiece::Map(QVector<T> points) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < points.size(); ++i)
|
std::transform(points.begin(), points.end(), points.begin(),
|
||||||
{
|
[this](const auto &point) { return d->matrix.map(point); });
|
||||||
points[i] = d->matrix.map(points.at(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d->mirror)
|
if (d->mirror)
|
||||||
{
|
{
|
||||||
QList<T> list = ConvertToList(points);
|
std::reverse(points.begin(), points.end());
|
||||||
|
|
||||||
for (int k=0, s=list.size(), max=(s/2); k<max; k++)
|
|
||||||
{
|
|
||||||
SwapItemsAt(list, k, s-(1+k));
|
|
||||||
}
|
|
||||||
points = ConvertToVector(list);
|
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,15 +148,16 @@ inline QVector<T> ConvertToVector(const QSet<T> &container)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
// NOTE: Delete if not necessary anymore
|
||||||
inline void SwapItemsAt(T &container, int i, int j)
|
//template <typename T>
|
||||||
{
|
//inline void SwapItemsAt(T &container, int i, int j)
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
//{
|
||||||
container.swapItemsAt(i, j);
|
//#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
||||||
#else
|
// container.swapItemsAt(i, j);
|
||||||
container.swap(i, j);
|
//#else
|
||||||
#endif
|
// container.swap(i, j);
|
||||||
}
|
//#endif
|
||||||
|
//}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user