modernize C++: use transparent functors

This commit is contained in:
wmayer
2023-08-07 13:31:19 +02:00
committed by wwmayer
parent 31ed14db83
commit b6f331f4fa
7 changed files with 13 additions and 11 deletions

View File

@@ -267,7 +267,7 @@ private:
std::map<const char*, IndexedElements, CStringComp> indexedNames;
std::map<MappedName, IndexedName, std::less<MappedName>> mappedNames;
std::map<MappedName, IndexedName, std::less<>> mappedNames;
struct ChildMapInfo
{

View File

@@ -344,7 +344,7 @@ std::vector<std::pair<QByteArray, QAction*>> ShortcutManager::getActionsByShortc
{
const auto &index = actionMap.get<1>();
std::vector<std::pair<QByteArray, QAction*>> res;
std::multimap<int, const ActionData*, std::greater<int>> map;
std::multimap<int, const ActionData*, std::greater<>> map;
for (auto it = index.lower_bound(ActionKey(shortcut)); it != index.end(); ++it) {
if (it->key.shortcut != shortcut)
break;

View File

@@ -337,7 +337,7 @@ void MeshFastBuilder::Finish ()
//std::sort(verts.begin(), verts.end());
int threads = QThread::idealThreadCount();
MeshCore::parallel_sort(verts.begin(), verts.end(), std::less<Private::Vertex>(), threads);
MeshCore::parallel_sort(verts.begin(), verts.end(), std::less<>(), threads);
QVector<FacetIndex> indices(ulCtPts);

View File

@@ -517,7 +517,7 @@ bool MeshRemoveNeedles::Fixup()
std::priority_queue<FaceEdgePriority,
std::vector<FaceEdgePriority>,
std::greater<FaceEdgePriority> > todo;
std::greater<> > todo;
for (std::size_t index = 0; index < facetCount; index++) {
const MeshFacet& facet = rclFAry[index];
MeshGeomFacet tria(_rclMesh.GetFacet(facet));
@@ -615,7 +615,7 @@ bool MeshFixCaps::Fixup()
std::priority_queue<FaceVertexPriority,
std::vector<FaceVertexPriority>,
std::greater<FaceVertexPriority> > todo;
std::greater<> > todo;
for (std::size_t index = 0; index < facetCount; index++) {
for (int i=0; i<3; i++) {
const MeshFacet& facet = rclFAry[index];

View File

@@ -50,7 +50,8 @@
#include "Utils.h"
#include "ViewProviderSketch.h"
// Hint: this is to prevent to re-format big parts of the file. Remove it later again.
// clang-format off
using namespace std;
using namespace SketcherGui;
using namespace Sketcher;
@@ -806,7 +807,7 @@ void CmdSketcherRestoreInternalAlignmentGeometry::activated(int iMsg)
// Handle highest GeoIds first to minimize GeoIds changing
// TODO: this might not completely resolve GeoIds changing
std::sort(SubGeoIds.begin(), SubGeoIds.end(), std::greater<int>());
std::sort(SubGeoIds.begin(), SubGeoIds.end(), std::greater<>());
// Keep unique
SubGeoIds.erase(std::unique(SubGeoIds.begin(), SubGeoIds.end()), SubGeoIds.end());
@@ -2277,3 +2278,4 @@ void CreateSketcherCommandsConstraintAccel()
rcCmdMgr.addCommand(new CmdSketcherDeleteAllConstraints());
rcCmdMgr.addCommand(new CmdSketcherRemoveAxesAlignment());
}
// clang-format on

View File

@@ -370,7 +370,7 @@ void SheetTableView::removeRows()
/* Make sure rows are sorted in descending order */
for (QModelIndexList::const_iterator it = rows.cbegin(); it != rows.cend(); ++it)
sortedRows.push_back(it->row());
std::sort(sortedRows.begin(), sortedRows.end(), std::greater<int>());
std::sort(sortedRows.begin(), sortedRows.end(), std::greater<>());
/* Remove rows */
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Remove rows"));
@@ -443,7 +443,7 @@ void SheetTableView::removeColumns()
/* Make sure rows are sorted in descending order */
for (QModelIndexList::const_iterator it = cols.cbegin(); it != cols.cend(); ++it)
sortedColumns.push_back(it->column());
std::sort(sortedColumns.begin(), sortedColumns.end(), std::greater<int>());
std::sort(sortedColumns.begin(), sortedColumns.end(), std::greater<>());
/* Remove columns */
Gui::Command::openCommand(QT_TRANSLATE_NOOP("Command", "Remove rows"));

View File

@@ -748,7 +748,7 @@ std::vector<TechDraw::DrawViewDimension*> DrawViewPart::getDimensions() const
{
std::vector<TechDraw::DrawViewDimension*> result;
std::vector<App::DocumentObject*> children = getInList();
std::sort(children.begin(), children.end(), std::less<App::DocumentObject*>());
std::sort(children.begin(), children.end(), std::less<>());
std::vector<App::DocumentObject*>::iterator newEnd =
std::unique(children.begin(), children.end());
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != newEnd; ++it) {
@@ -764,7 +764,7 @@ std::vector<TechDraw::DrawViewBalloon*> DrawViewPart::getBalloons() const
{
std::vector<TechDraw::DrawViewBalloon*> result;
std::vector<App::DocumentObject*> children = getInList();
std::sort(children.begin(), children.end(), std::less<App::DocumentObject*>());
std::sort(children.begin(), children.end(), std::less<>());
std::vector<App::DocumentObject*>::iterator newEnd =
std::unique(children.begin(), children.end());
for (std::vector<App::DocumentObject*>::iterator it = children.begin(); it != newEnd; ++it) {