From 618089d6d85cfa11722768cd5eb19d2f0ee5103d Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 11 May 2020 13:46:37 +0200 Subject: [PATCH] remove deprecated std::binary_function --- src/Base/Tools.cpp | 3 +-- src/Mod/Mesh/App/Core/Degeneration.cpp | 12 ++++------- src/Mod/Mesh/App/Core/Elements.h | 20 +++++++++++++++---- src/Mod/Mesh/App/Core/Evaluation.cpp | 3 +-- src/Mod/Mesh/App/Core/MeshIO.cpp | 10 ++++++---- src/Mod/Mesh/App/Core/Tools.h | 2 +- src/Mod/Mesh/App/Core/TopoAlgorithm.h | 6 ++---- src/Mod/Mesh/App/Core/Triangulation.cpp | 4 ++-- src/Mod/Mesh/Gui/MeshEditor.cpp | 3 +-- src/Mod/MeshPart/App/CurveProjector.h | 2 +- src/Mod/Part/App/FaceMakerCheese.h | 3 +-- src/Mod/PartDesign/App/FeatureSketchBased.cpp | 3 +-- src/Mod/Sketcher/App/SketchAnalysis.cpp | 12 ++++------- 13 files changed, 41 insertions(+), 42 deletions(-) diff --git a/src/Base/Tools.cpp b/src/Base/Tools.cpp index 4536303e93..167b9bed36 100644 --- a/src/Base/Tools.cpp +++ b/src/Base/Tools.cpp @@ -34,8 +34,7 @@ #include "Tools.h" namespace Base { -struct string_comp : public std::binary_function +struct string_comp { // s1 and s2 must be numbers represented as string bool operator()(const std::string& s1, const std::string& s2) diff --git a/src/Mod/Mesh/App/Core/Degeneration.cpp b/src/Mod/Mesh/App/Core/Degeneration.cpp index 91ec5189ac..6b09730d72 100644 --- a/src/Mod/Mesh/App/Core/Degeneration.cpp +++ b/src/Mod/Mesh/App/Core/Degeneration.cpp @@ -102,8 +102,7 @@ typedef MeshPointArray::_TConstIterator VertexIterator; * '==' operator of MeshPoint) we use the same operator when comparing the * points in the function object. */ -struct Vertex_EqualTo : public std::binary_function +struct Vertex_EqualTo { bool operator()(const VertexIterator& x, const VertexIterator& y) const @@ -116,8 +115,7 @@ struct Vertex_EqualTo : public std::binary_function +struct Vertex_Less { bool operator()(const VertexIterator& x, const VertexIterator& y) const @@ -277,8 +275,7 @@ typedef MeshFacetArray::_TConstIterator FaceIterator; /* * The facet with the lowset index is regarded as 'less'. */ -struct MeshFacet_Less : public std::binary_function +struct MeshFacet_Less { bool operator()(const FaceIterator& x, const FaceIterator& y) const @@ -319,8 +316,7 @@ struct MeshFacet_Less : public std::binary_function +struct MeshFacet_EqualTo { bool operator()(const FaceIterator& x, const FaceIterator& y) const diff --git a/src/Mod/Mesh/App/Core/Elements.h b/src/Mod/Mesh/App/Core/Elements.h index 8d958b8a06..83bf821ef5 100644 --- a/src/Mod/Mesh/App/Core/Elements.h +++ b/src/Mod/Mesh/App/Core/Elements.h @@ -1075,9 +1075,12 @@ inline bool MeshFacet::IsEqual (const MeshFacet& rcFace) const * Binary function to query the flags for use with generic STL functions. */ template -class MeshIsFlag : public std::binary_function +class MeshIsFlag { public: + typedef TCLASS first_argument_type; + typedef typename TCLASS::TFlagType second_argument_type; + typedef bool result_type; bool operator () (const TCLASS& rclElem, typename TCLASS::TFlagType tFlag) const { return rclElem.IsFlag(tFlag); } }; @@ -1086,9 +1089,12 @@ public: * Binary function to query the flags for use with generic STL functions. */ template -class MeshIsNotFlag : public std::binary_function +class MeshIsNotFlag { public: + typedef TCLASS first_argument_type; + typedef typename TCLASS::TFlagType second_argument_type; + typedef bool result_type; bool operator () (const TCLASS& rclElem, typename TCLASS::TFlagType tFlag) const { return !rclElem.IsFlag(tFlag); } }; @@ -1097,9 +1103,12 @@ public: * Binary function to set the flags for use with generic STL functions. */ template -class MeshSetFlag : public std::binary_function +class MeshSetFlag { public: + typedef TCLASS first_argument_type; + typedef typename TCLASS::TFlagType second_argument_type; + typedef bool result_type; bool operator () (const TCLASS& rclElem, typename TCLASS::TFlagType tFlag) const { rclElem.SetFlag(tFlag); return true; } }; @@ -1108,9 +1117,12 @@ public: * Binary function to reset the flags for use with generic STL functions. */ template -class MeshResetFlag : public std::binary_function +class MeshResetFlag { public: + typedef TCLASS first_argument_type; + typedef typename TCLASS::TFlagType second_argument_type; + typedef bool result_type; bool operator () (const TCLASS& rclElem, typename TCLASS::TFlagType tFlag) const { rclElem.ResetFlag(tFlag); return true; } }; diff --git a/src/Mod/Mesh/App/Core/Evaluation.cpp b/src/Mod/Mesh/App/Core/Evaluation.cpp index c91f0c6c9e..23e0afb0df 100644 --- a/src/Mod/Mesh/App/Core/Evaluation.cpp +++ b/src/Mod/Mesh/App/Core/Evaluation.cpp @@ -312,8 +312,7 @@ struct Edge_Index unsigned long p0, p1, f; }; -struct Edge_Less : public std::binary_function +struct Edge_Less { bool operator()(const Edge_Index& x, const Edge_Index& y) const { diff --git a/src/Mod/Mesh/App/Core/MeshIO.cpp b/src/Mod/Mesh/App/Core/MeshIO.cpp index 5eea9d8b60..f780d03d6e 100644 --- a/src/Mod/Mesh/App/Core/MeshIO.cpp +++ b/src/Mod/Mesh/App/Core/MeshIO.cpp @@ -119,8 +119,7 @@ struct QUAD {int iV[4];}; namespace MeshCore { -struct Color_Less : public std::binary_function +struct Color_Less { bool operator()(const App::Color& x, const App::Color& y) const @@ -759,9 +758,12 @@ namespace MeshCore { enum Number { int8, uint8, int16, uint16, int32, uint32, float32, float64 }; - struct Property : public std::binary_function, - std::string, bool> + struct Property { + typedef std::pair first_argument_type; + typedef std::string second_argument_type; + typedef bool result_type; + bool operator()(const std::pair& x, const std::string& y) const { diff --git a/src/Mod/Mesh/App/Core/Tools.h b/src/Mod/Mesh/App/Core/Tools.h index 53b4716b6b..589ff66fe7 100644 --- a/src/Mod/Mesh/App/Core/Tools.h +++ b/src/Mod/Mesh/App/Core/Tools.h @@ -67,7 +67,7 @@ protected: inline bool TriangleCutsSphere (const MeshFacet &rclF) const; bool ExpandRadius (unsigned long ulMinPoints); - struct CDistRad : public std::binary_function + struct CDistRad { CDistRad (const Base::Vector3f clCenter) : _clCenter(clCenter) {} bool operator()(const Base::Vector3f &rclPt1, const Base::Vector3f &rclPt2) { return Base::DistanceP2(_clCenter, rclPt1) < Base::DistanceP2(_clCenter, rclPt2); } diff --git a/src/Mod/Mesh/App/Core/TopoAlgorithm.h b/src/Mod/Mesh/App/Core/TopoAlgorithm.h index dce97a8e65..a2d56d0355 100644 --- a/src/Mod/Mesh/App/Core/TopoAlgorithm.h +++ b/src/Mod/Mesh/App/Core/TopoAlgorithm.h @@ -303,8 +303,7 @@ private: MeshKernel& _rclMesh; bool _needsCleanup; - struct Vertex_Less : public std::binary_function + struct Vertex_Less { bool operator()(const Base::Vector3f& x, const Base::Vector3f& y) const; }; @@ -344,8 +343,7 @@ public: protected: // for sorting of elements - struct CNofFacetsCompare : public std::binary_function&, - const std::vector&, bool> + struct CNofFacetsCompare { bool operator () (const std::vector &rclC1, const std::vector &rclC2) diff --git a/src/Mod/Mesh/App/Core/Triangulation.cpp b/src/Mod/Mesh/App/Core/Triangulation.cpp index 74e6410da2..816d30a7b9 100644 --- a/src/Mod/Mesh/App/Core/Triangulation.cpp +++ b/src/Mod/Mesh/App/Core/Triangulation.cpp @@ -598,7 +598,7 @@ bool QuasiDelaunayTriangulator::Triangulate() namespace MeshCore { namespace Triangulation { -struct Vertex2d_Less : public std::binary_function +struct Vertex2d_Less { bool operator()(const Base::Vector3f& p, const Base::Vector3f& q) const { @@ -608,7 +608,7 @@ struct Vertex2d_Less : public std::binary_function +struct Vertex2d_EqualTo { bool operator()(const Base::Vector3f& p, const Base::Vector3f& q) const { diff --git a/src/Mod/Mesh/Gui/MeshEditor.cpp b/src/Mod/Mesh/Gui/MeshEditor.cpp index a7f1723deb..30cc2295fb 100644 --- a/src/Mod/Mesh/Gui/MeshEditor.cpp +++ b/src/Mod/Mesh/Gui/MeshEditor.cpp @@ -415,8 +415,7 @@ void MeshFaceAddition::addFacetCallback(void * ud, SoEventCallback * n) namespace MeshGui { // for sorting of elements - struct NofFacetsCompare : public std::binary_function&, - const std::vector&, bool> + struct NofFacetsCompare { bool operator () (const std::vector &rclC1, const std::vector &rclC2) diff --git a/src/Mod/MeshPart/App/CurveProjector.h b/src/Mod/MeshPart/App/CurveProjector.h index 1e6b2eca0f..6076971d14 100644 --- a/src/Mod/MeshPart/App/CurveProjector.h +++ b/src/Mod/MeshPart/App/CurveProjector.h @@ -62,7 +62,7 @@ public: }; template - struct TopoDSLess : public std::binary_function { + struct TopoDSLess { bool operator()(const T& x, const T& y) const { return x.HashCode(INT_MAX-1) < y.HashCode(INT_MAX-1); } diff --git a/src/Mod/Part/App/FaceMakerCheese.h b/src/Mod/Part/App/FaceMakerCheese.h index 28043a058a..07cfc2a637 100644 --- a/src/Mod/Part/App/FaceMakerCheese.h +++ b/src/Mod/Part/App/FaceMakerCheese.h @@ -50,8 +50,7 @@ public: //in Extrusion, they used to be private. but they are also used by PartD /** * @brief The Wire_Compare class is for sorting wires by bounding box diagonal length */ - class Wire_Compare : public std::binary_function + class Wire_Compare { public: bool operator() (const TopoDS_Wire& w1, const TopoDS_Wire& w2); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 17646ce4ed..77824c8d34 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -884,8 +884,7 @@ void ProfileBased::remapSupportShape(const TopoDS_Shape& newShape) } namespace PartDesign { -struct gp_Pnt_Less : public std::binary_function +struct gp_Pnt_Less { bool operator()(const gp_Pnt& p1, const gp_Pnt& p2) const diff --git a/src/Mod/Sketcher/App/SketchAnalysis.cpp b/src/Mod/Sketcher/App/SketchAnalysis.cpp index c22a13b91e..fa576b6b5e 100644 --- a/src/Mod/Sketcher/App/SketchAnalysis.cpp +++ b/src/Mod/Sketcher/App/SketchAnalysis.cpp @@ -68,8 +68,7 @@ struct SketchAnalysis::VertexIds { Sketcher::PointPos PosId; }; -struct SketchAnalysis::Vertex_Less : public std::binary_function +struct SketchAnalysis::Vertex_Less { Vertex_Less(double tolerance) : tolerance(tolerance){} bool operator()(const VertexIds& x, @@ -87,8 +86,7 @@ private: double tolerance; }; -struct SketchAnalysis::Vertex_EqualTo : public std::binary_function +struct SketchAnalysis::Vertex_EqualTo { Vertex_EqualTo(double tolerance) : tolerance(tolerance){} bool operator()(const VertexIds& x, @@ -112,8 +110,7 @@ struct SketchAnalysis::EdgeIds { int GeoId; }; -struct SketchAnalysis::Edge_Less : public std::binary_function +struct SketchAnalysis::Edge_Less { Edge_Less(double tolerance) : tolerance(tolerance){} bool operator()(const EdgeIds& x, @@ -127,8 +124,7 @@ private: double tolerance; }; -struct SketchAnalysis::Edge_EqualTo : public std::binary_function +struct SketchAnalysis::Edge_EqualTo { Edge_EqualTo(double tolerance) : tolerance(tolerance){} bool operator()(const EdgeIds& x,