From: Joel Holdsworth Date: Fri, 29 Aug 2014 11:58:59 +0000 (+0100) Subject: View: Replace compare_trace_v_offsets with a lambda X-Git-Tag: pulseview-0.3.0~487 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2c25d912f97ca7bedd9c03f4827fe8d8a189e8bc;p=pulseview.git View: Replace compare_trace_v_offsets with a lambda --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index af0892b8..305031eb 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -259,7 +259,10 @@ vector< shared_ptr > View::get_traces() const i = copy(decode_sigs.begin(), decode_sigs.end(), i); #endif - stable_sort(traces.begin(), traces.end(), compare_trace_v_offsets); + stable_sort(traces.begin(), traces.end(), + [](const shared_ptr &a, const shared_ptr &b) { + return a->get_v_offset() < b->get_v_offset(); }); + return traces; } @@ -442,14 +445,6 @@ void View::update_layout() update_scroll(); } -bool View::compare_trace_v_offsets(const shared_ptr &a, - const shared_ptr &b) -{ - assert(a); - assert(b); - return a->get_v_offset() < b->get_v_offset(); -} - bool View::eventFilter(QObject *object, QEvent *event) { const QEvent::Type type = event->type(); diff --git a/pv/view/view.h b/pv/view/view.h index 8229fbd2..6e097a4d 100644 --- a/pv/view/view.h +++ b/pv/view/view.h @@ -164,10 +164,6 @@ private: void update_layout(); - static bool compare_trace_v_offsets( - const std::shared_ptr &a, - const std::shared_ptr &b); - private: bool eventFilter(QObject *object, QEvent *event);