Skip to content

Commit

Permalink
Remove usage of std::bind
Browse files Browse the repository at this point in the history
It is deprecated after C++11.
  • Loading branch information
xlz committed Dec 12, 2017
1 parent 1497106 commit d322e53
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion include/internal/libfreenect2/threading.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <functional>

#define WAIT_CONDITION(var, mutex, lock) var.wait(lock);

Expand Down
2 changes: 1 addition & 1 deletion src/frame_listener_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool SyncMultiFrameListener::waitForNewFrame(FrameMap &frame, int milliseconds)
#ifdef LIBFREENECT2_THREADING_STDLIB
libfreenect2::unique_lock l(impl_->mutex_);

auto predicate = std::bind(&SyncMultiFrameListenerImpl::hasNewFrame, impl_);
auto predicate = [this]{ return impl_->hasNewFrame(); };

if(impl_->condition_.wait_for(l, std::chrono::milliseconds(milliseconds), predicate))
{
Expand Down
6 changes: 4 additions & 2 deletions src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#ifdef LIBFREENECT2_WITH_PROFILING
#include <vector>
#include <numeric>
#include <functional>
#include <cmath>
#endif

Expand Down Expand Up @@ -276,7 +275,10 @@ class WithPerfLoggingImpl: public Timer
size_t n = v.size();
double mean = sum / n;
std::vector<double> diff(n);
std::transform(v.begin(), v.end(), diff.begin(), std::bind2nd(std::minus<double>(), mean));
for (size_t i = 0; i < n; ++i)
{
diff[i] = v[i] - mean;
}
double sqsum = std::inner_product(diff.begin(), diff.end(), diff.begin(), 0.0);
double std = std::sqrt(sqsum / (n-1));

Expand Down

0 comments on commit d322e53

Please sign in to comment.