Skip to content
Snippets Groups Projects
Commit 6b7ee14c authored by Spiros Tsalikis's avatar Spiros Tsalikis
Browse files

Eliminate modernize-avoid-bind warnings

parent 1733ea9d
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,9 @@ int TestIndexedArray(int vtkNotUsed(argc), char* vtkNotUsed(argv)[])
handles->SetNumberOfIds(100);
std::random_device randdev;
std::mt19937 generator(randdev());
auto index_rand = std::bind(std::uniform_int_distribution<vtkIdType>(0, 999), generator);
std::uniform_int_distribution<vtkIdType> dist(0, 999);
auto index_rand = [&]() { return dist(generator); };
for (vtkIdType idx = 0; idx < 100; idx++)
{
handles->SetId(idx, index_rand());
......
......@@ -217,7 +217,8 @@ vtkThreadedTaskQueue<R, Args...>::~vtkThreadedTaskQueue()
template <typename R, typename... Args>
void vtkThreadedTaskQueue<R, Args...>::Push(Args&&... args)
{
this->Tasks->Push(std::bind(this->Worker, args...));
this->Tasks->Push([this, arguments = std::make_tuple(std::forward<Args>(args)...)]()
{ return std::apply(this->Worker, arguments); });
}
//-----------------------------------------------------------------------------
......@@ -320,7 +321,8 @@ vtkThreadedTaskQueue<void, Args...>::~vtkThreadedTaskQueue()
template <typename... Args>
void vtkThreadedTaskQueue<void, Args...>::Push(Args&&... args)
{
this->Tasks->Push(std::bind(this->Worker, args...));
this->Tasks->Push([this, arguments = std::make_tuple(std::forward<Args>(args)...)]()
{ std::apply(this->Worker, arguments); });
}
//-----------------------------------------------------------------------------
......
......@@ -193,7 +193,7 @@ struct Spread
// point_data /= denum
auto dstTuple = dstTuples[pid];
std::transform(dstTuple.cbegin(), dstTuple.cend(), dstTuple.begin(),
std::bind(std::divides<T>(), std::placeholders::_1, denom));
[denom](T value) { return value / denom; });
}
}
}
......
......@@ -90,8 +90,10 @@ void vtkOpenGLMovieSphere::SetVideoSource(vtkFFMPEGVideoSource* video)
this->NewData = 0;
this->HaveData = 0;
video->SetVideoCallback(
std::bind(&vtkOpenGLMovieSphere::VideoCallback, this, std::placeholders::_1), nullptr);
// Use lambda instead of std::bind
video->SetVideoCallback([this](vtkFFMPEGVideoSourceVideoCallbackData const& cbd)
{ this->VideoCallback(cbd); },
nullptr);
this->Modified();
}
......
......@@ -232,7 +232,7 @@ public:
{
using std::placeholders::_1;
std::function<void(ObjType*)> func = std::bind(setter, _1, value);
std::function<void(ObjType*)> func = [setter, value](ObjType* obj) { (obj->*setter)(value); };
Option& opt = this->FindOrCreateOption(optionName);
opt.Values.emplace_back(valueName, func);
this->OptionTime.Modified();
......
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