Skip to content
Snippets Groups Projects
Commit d2d9f7d4 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

warnings: remove usage of `std::binary_function`

This type is gone in C++17. Instead, just use lambdas and static
functions.
parent a3d59cde
No related merge requests found
......@@ -29,7 +29,6 @@
#include <vtkTemporalInterpolator.h>
#include <cassert>
#include <functional>
#include <vector>
namespace
......@@ -101,15 +100,10 @@ int vtkTemporalSphereSource2::RequestInformation(
}
//------------------------------------------------------------------------------
class vtkTestTemporalCacheSimpleWithinTolerance2 : public std::binary_function<double, double, bool>
static bool vtkTestTemporalCacheSimpleWithinTolerance2(double a, double b)
{
public:
result_type operator()(first_argument_type a, second_argument_type b) const
{
bool result = (fabs(a - b) <= (a * 1E-6));
return (result_type)result;
}
};
return (fabs(a - b) <= (a * 1E-6));
}
//------------------------------------------------------------------------------
int vtkTemporalSphereSource2::RequestData(
......@@ -122,9 +116,11 @@ int vtkTemporalSphereSource2::RequestData(
if (this->TimeStep == 0 && outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
{
double requestedTimeValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
this->ActualTimeStep = std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(),
std::bind(vtkTestTemporalCacheSimpleWithinTolerance2(),
std::placeholders::_1, requestedTimeValue)) -
this->ActualTimeStep =
std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(),
[requestedTimeValue](double const& v) {
return vtkTestTemporalCacheSimpleWithinTolerance2(v, requestedTimeValue);
}) -
this->TimeStepValues.begin();
this->ActualTimeStep = this->ActualTimeStep + this->TimeStepRange[0];
}
......
......@@ -32,7 +32,6 @@
#include "vtkTemporalInterpolator.h"
#include "vtkThreshold.h"
#include <algorithm>
#include <functional>
#include <vector>
//
......@@ -116,15 +115,12 @@ int vtkTemporalSphereSource::RequestInformation(
return 1;
}
//------------------------------------------------------------------------------
class vtkTestTemporalCacheSimpleWithinTolerance : public std::binary_function<double, double, bool>
static bool vtkTestTemporalCacheSimpleWithinTolerance(double a, double b)
{
public:
result_type operator()(first_argument_type a, second_argument_type b) const
{
bool result = (fabs(a - b) <= (a * 1E-6));
return (result_type)result;
}
};
return (fabs(a - b) <= (a * 1E-6));
}
//------------------------------------------------------------------------------
int vtkTemporalSphereSource::RequestData(
vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
......@@ -137,9 +133,11 @@ int vtkTemporalSphereSource::RequestData(
if (this->TimeStep == 0 && outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()))
{
double requestedTimeValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP());
this->ActualTimeStep = std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(),
std::bind(vtkTestTemporalCacheSimpleWithinTolerance(),
std::placeholders::_1, requestedTimeValue)) -
this->ActualTimeStep =
std::find_if(this->TimeStepValues.begin(), this->TimeStepValues.end(),
[requestedTimeValue](double const& v) {
return vtkTestTemporalCacheSimpleWithinTolerance(v, requestedTimeValue);
}) -
this->TimeStepValues.begin();
this->ActualTimeStep = this->ActualTimeStep + this->TimeStepRange[0];
}
......
......@@ -73,7 +73,6 @@
#include "vtkUnsignedShortArray.h"
#include <algorithm>
#include <functional>
#include "vtk_h5part.h"
// clang-format off
......@@ -480,17 +479,13 @@ int GetVTKDataType(hid_t datatype)
H5Dclose(dataset); \
}
class H5PartToleranceCheck : public std::binary_function<double, double, bool>
class H5PartToleranceCheck
{
public:
H5PartToleranceCheck(double tol) { this->tolerance = tol; }
double tolerance;
//
result_type operator()(first_argument_type a, second_argument_type b) const
{
bool result = (fabs(a - b) <= (this->tolerance));
return (result_type)result;
}
bool operator()(double a, double b) const { return (fabs(a - b) <= (this->tolerance)); }
};
//------------------------------------------------------------------------------
int vtkH5PartReader::RequestData(vtkInformation* vtkNotUsed(request),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment