Skip to content

Commit

Permalink
A few code changes to compile as C++14 and C++17
Browse files Browse the repository at this point in the history
Still C++11 compatible of course.
  • Loading branch information
seanm committed Jan 14, 2019
1 parent 6b0342d commit de04e0a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions Common/Core/vtkMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "vtkMathConfigure.h" // For <cmath> and VTK_HAS_ISNAN etc.

#include <cassert> // assert() in inline implementations.
#include <algorithm> // for std::clamp

#ifndef DBL_MIN
# define VTK_DBL_MIN 2.2250738585072014e-308
Expand Down
2 changes: 1 addition & 1 deletion Filters/Core/vtkCellDataToPointData.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace
// divide point data by the number of cells using it <==>
// point_data /= denum
std::transform(dstbeg, dstbeg+ncomps, dstbeg,
std::bind2nd(std::divides<T>(), denom));
std::bind(std::divides<T>(), std::placeholders::_1, denom));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Filters/FlowPaths/vtkTemporalStreamTracer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ int vtkTemporalStreamTracer::RequestUpdateExtent(
this->ActualTimeStep = std::find_if(
this->OutputTimeValues.begin(),
this->OutputTimeValues.end(),
std::bind2nd( WithinTolerance( ), requestedTimeValue ))
std::bind( WithinTolerance( ), std::placeholders::_1, requestedTimeValue ))
- this->OutputTimeValues.begin();
if (this->ActualTimeStep>=this->OutputTimeValues.size())
{
Expand Down
2 changes: 1 addition & 1 deletion Filters/Hybrid/Testing/Cxx/TestTemporalCacheSimple.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int vtkTemporalSphereSource::RequestData(
this->ActualTimeStep = std::find_if(
this->TimeStepValues.begin(),
this->TimeStepValues.end(),
std::bind2nd( vtkTestTemporalCacheSimpleWithinTolerance( ), requestedTimeValue ))
std::bind( vtkTestTemporalCacheSimpleWithinTolerance( ), std::placeholders::_1, requestedTimeValue ))
- this->TimeStepValues.begin();
this->ActualTimeStep = this->ActualTimeStep + this->TimeStepRange[0];
}
Expand Down
11 changes: 6 additions & 5 deletions IO/XML/vtkXMLReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <locale> // C++ locale
#include <sstream>
#include <vector>
#include <cctype>

vtkCxxSetObjectMacro(vtkXMLReader,ReaderErrorObserver,vtkCommand);
vtkCxxSetObjectMacro(vtkXMLReader,ParserErrorObserver,vtkCommand);
Expand Down Expand Up @@ -996,17 +997,17 @@ namespace {

void ltrim(std::string &s)
{
s.erase(s.begin(),
std::find_if(s.begin(),
s.end(),
std::not1(std::ptr_fun<int, int>(isspace))));
s.erase(s.begin(),
std::find_if(s.begin(),
s.end(),
[] (int ch) { return !std::isspace(ch); }));
}

void rtrim(std::string &s)
{
s.erase(std::find_if(s.rbegin(),
s.rend(),
std::not1(std::ptr_fun<int, int>(isspace))).base(),
[] (int ch) { return !std::isspace(ch); }).base(),
s.end());
}

Expand Down

0 comments on commit de04e0a

Please sign in to comment.