Skip to content

Commit

Permalink
remove deprecated std::binary_function
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 11, 2020
1 parent 4d8db64 commit 618089d
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 42 deletions.
3 changes: 1 addition & 2 deletions src/Base/Tools.cpp
Expand Up @@ -34,8 +34,7 @@
#include "Tools.h"

namespace Base {
struct string_comp : public std::binary_function<std::string,
std::string, bool>
struct string_comp
{
// s1 and s2 must be numbers represented as string
bool operator()(const std::string& s1, const std::string& s2)
Expand Down
12 changes: 4 additions & 8 deletions src/Mod/Mesh/App/Core/Degeneration.cpp
Expand Up @@ -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<const VertexIterator&,
const VertexIterator&, bool>
struct Vertex_EqualTo
{
bool operator()(const VertexIterator& x,
const VertexIterator& y) const
Expand All @@ -116,8 +115,7 @@ struct Vertex_EqualTo : public std::binary_function<const VertexIterator&,
}
};

struct Vertex_Less : public std::binary_function<const VertexIterator&,
const VertexIterator&, bool>
struct Vertex_Less
{
bool operator()(const VertexIterator& x,
const VertexIterator& y) const
Expand Down Expand Up @@ -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<const FaceIterator&,
const FaceIterator&, bool>
struct MeshFacet_Less
{
bool operator()(const FaceIterator& x,
const FaceIterator& y) const
Expand Down Expand Up @@ -319,8 +316,7 @@ struct MeshFacet_Less : public std::binary_function<const FaceIterator&,
* Two facets are equal if all its three point indices refer to the same
* location in the point array of the mesh kernel they belong to.
*/
struct MeshFacet_EqualTo : public std::binary_function<const FaceIterator&,
const FaceIterator&, bool>
struct MeshFacet_EqualTo
{
bool operator()(const FaceIterator& x,
const FaceIterator& y) const
Expand Down
20 changes: 16 additions & 4 deletions src/Mod/Mesh/App/Core/Elements.h
Expand Up @@ -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 TCLASS>
class MeshIsFlag : public std::binary_function<TCLASS, typename TCLASS::TFlagType, bool>
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); }
};
Expand All @@ -1086,9 +1089,12 @@ class MeshIsFlag : public std::binary_function<TCLASS, typename TCLASS::TFlagTyp
* Binary function to query the flags for use with generic STL functions.
*/
template <class TCLASS>
class MeshIsNotFlag : public std::binary_function<TCLASS, typename TCLASS::TFlagType, bool>
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); }
};
Expand All @@ -1097,9 +1103,12 @@ class MeshIsNotFlag : public std::binary_function<TCLASS, typename TCLASS::TFlag
* Binary function to set the flags for use with generic STL functions.
*/
template <class TCLASS>
class MeshSetFlag : public std::binary_function<TCLASS, typename TCLASS::TFlagType, bool>
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; }
};
Expand All @@ -1108,9 +1117,12 @@ class MeshSetFlag : public std::binary_function<TCLASS, typename TCLASS::TFlagTy
* Binary function to reset the flags for use with generic STL functions.
*/
template <class TCLASS>
class MeshResetFlag : public std::binary_function<TCLASS, typename TCLASS::TFlagType, bool>
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; }
};
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Mesh/App/Core/Evaluation.cpp
Expand Up @@ -312,8 +312,7 @@ struct Edge_Index
unsigned long p0, p1, f;
};

struct Edge_Less : public std::binary_function<const Edge_Index&,
const Edge_Index&, bool>
struct Edge_Less
{
bool operator()(const Edge_Index& x, const Edge_Index& y) const
{
Expand Down
10 changes: 6 additions & 4 deletions src/Mod/Mesh/App/Core/MeshIO.cpp
Expand Up @@ -119,8 +119,7 @@ struct QUAD {int iV[4];};

namespace MeshCore {

struct Color_Less : public std::binary_function<const App::Color&,
const App::Color&, bool>
struct Color_Less
{
bool operator()(const App::Color& x,
const App::Color& y) const
Expand Down Expand Up @@ -759,9 +758,12 @@ namespace MeshCore {
enum Number {
int8, uint8, int16, uint16, int32, uint32, float32, float64
};
struct Property : public std::binary_function<std::pair<std::string, Number>,
std::string, bool>
struct Property
{
typedef std::pair<std::string, int> first_argument_type;
typedef std::string second_argument_type;
typedef bool result_type;

bool operator()(const std::pair<std::string, int>& x,
const std::string& y) const
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Mesh/App/Core/Tools.h
Expand Up @@ -67,7 +67,7 @@ class MeshSearchNeighbours
inline bool TriangleCutsSphere (const MeshFacet &rclF) const;
bool ExpandRadius (unsigned long ulMinPoints);

struct CDistRad : public std::binary_function<const Base::Vector3f&, const Base::Vector3f&, bool>
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); }
Expand Down
6 changes: 2 additions & 4 deletions src/Mod/Mesh/App/Core/TopoAlgorithm.h
Expand Up @@ -303,8 +303,7 @@ class MeshExport MeshTopoAlgorithm
MeshKernel& _rclMesh;
bool _needsCleanup;

struct Vertex_Less : public std::binary_function<const Base::Vector3f&,
const Base::Vector3f&, bool>
struct Vertex_Less
{
bool operator()(const Base::Vector3f& x, const Base::Vector3f& y) const;
};
Expand Down Expand Up @@ -344,8 +343,7 @@ class MeshExport MeshComponents

protected:
// for sorting of elements
struct CNofFacetsCompare : public std::binary_function<const std::vector<unsigned long>&,
const std::vector<unsigned long>&, bool>
struct CNofFacetsCompare
{
bool operator () (const std::vector<unsigned long> &rclC1,
const std::vector<unsigned long> &rclC2)
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Mesh/App/Core/Triangulation.cpp
Expand Up @@ -598,7 +598,7 @@ bool QuasiDelaunayTriangulator::Triangulate()

namespace MeshCore {
namespace Triangulation {
struct Vertex2d_Less : public std::binary_function<const Base::Vector3f&, const Base::Vector3f&, bool>
struct Vertex2d_Less
{
bool operator()(const Base::Vector3f& p, const Base::Vector3f& q) const
{
Expand All @@ -608,7 +608,7 @@ struct Vertex2d_Less : public std::binary_function<const Base::Vector3f&, const
} else return p.x < q.x;
}
};
struct Vertex2d_EqualTo : public std::binary_function<const Base::Vector3f&, const Base::Vector3f&, bool>
struct Vertex2d_EqualTo
{
bool operator()(const Base::Vector3f& p, const Base::Vector3f& q) const
{
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Mesh/Gui/MeshEditor.cpp
Expand Up @@ -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<unsigned long>&,
const std::vector<unsigned long>&, bool>
struct NofFacetsCompare
{
bool operator () (const std::vector<unsigned long> &rclC1,
const std::vector<unsigned long> &rclC2)
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/MeshPart/App/CurveProjector.h
Expand Up @@ -62,7 +62,7 @@ class MeshPartExport CurveProjector
};

template<class T>
struct TopoDSLess : public std::binary_function<T, T, bool> {
struct TopoDSLess {
bool operator()(const T& x, const T& y) const {
return x.HashCode(INT_MAX-1) < y.HashCode(INT_MAX-1);
}
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Part/App/FaceMakerCheese.h
Expand Up @@ -50,8 +50,7 @@ class PartExport FaceMakerCheese: public FaceMakerPublic
/**
* @brief The Wire_Compare class is for sorting wires by bounding box diagonal length
*/
class Wire_Compare : public std::binary_function<const TopoDS_Wire&,
const TopoDS_Wire&, bool>
class Wire_Compare
{
public:
bool operator() (const TopoDS_Wire& w1, const TopoDS_Wire& w2);
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/PartDesign/App/FeatureSketchBased.cpp
Expand Up @@ -884,8 +884,7 @@ void ProfileBased::remapSupportShape(const TopoDS_Shape& newShape)
}

namespace PartDesign {
struct gp_Pnt_Less : public std::binary_function<const gp_Pnt&,
const gp_Pnt&, bool>
struct gp_Pnt_Less
{
bool operator()(const gp_Pnt& p1,
const gp_Pnt& p2) const
Expand Down
12 changes: 4 additions & 8 deletions src/Mod/Sketcher/App/SketchAnalysis.cpp
Expand Up @@ -68,8 +68,7 @@ struct SketchAnalysis::VertexIds {
Sketcher::PointPos PosId;
};

struct SketchAnalysis::Vertex_Less : public std::binary_function<const VertexIds&,
const VertexIds&, bool>
struct SketchAnalysis::Vertex_Less
{
Vertex_Less(double tolerance) : tolerance(tolerance){}
bool operator()(const VertexIds& x,
Expand All @@ -87,8 +86,7 @@ struct SketchAnalysis::Vertex_Less : public std::binary_function<const VertexIds
double tolerance;
};

struct SketchAnalysis::Vertex_EqualTo : public std::binary_function<const VertexIds&,
const VertexIds&, bool>
struct SketchAnalysis::Vertex_EqualTo
{
Vertex_EqualTo(double tolerance) : tolerance(tolerance){}
bool operator()(const VertexIds& x,
Expand All @@ -112,8 +110,7 @@ struct SketchAnalysis::EdgeIds {
int GeoId;
};

struct SketchAnalysis::Edge_Less : public std::binary_function<const EdgeIds&,
const EdgeIds&, bool>
struct SketchAnalysis::Edge_Less
{
Edge_Less(double tolerance) : tolerance(tolerance){}
bool operator()(const EdgeIds& x,
Expand All @@ -127,8 +124,7 @@ const EdgeIds&, bool>
double tolerance;
};

struct SketchAnalysis::Edge_EqualTo : public std::binary_function<const EdgeIds&,
const EdgeIds&, bool>
struct SketchAnalysis::Edge_EqualTo
{
Edge_EqualTo(double tolerance) : tolerance(tolerance){}
bool operator()(const EdgeIds& x,
Expand Down

0 comments on commit 618089d

Please sign in to comment.