]> sigrok.org Git - pulseview.git/commitdiff
View: Replace compare_trace_v_offsets with a lambda
authorJoel Holdsworth <redacted>
Fri, 29 Aug 2014 11:58:59 +0000 (12:58 +0100)
committerJoel Holdsworth <redacted>
Wed, 19 Nov 2014 10:23:01 +0000 (10:23 +0000)
pv/view/view.cpp
pv/view/view.h

index af0892b81d1fb4d85003b179ce38f99d72369676..305031ebd466c9a0b699e4641fa8b6639b8c5e5c 100644 (file)
@@ -259,7 +259,10 @@ vector< shared_ptr<Trace> > 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<Trace> &a, const shared_ptr<Trace> &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<Trace> &a,
-       const shared_ptr<Trace> &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();
index 8229fbd25002b46f2acac89dc44682f1d4a52f21..6e097a4d68c11b4ba3e31df41e16f5a9d98a4dfc 100644 (file)
@@ -164,10 +164,6 @@ private:
 
        void update_layout();
 
-       static bool compare_trace_v_offsets(
-               const std::shared_ptr<pv::view::Trace> &a,
-               const std::shared_ptr<pv::view::Trace> &b);
-
 private:
        bool eventFilter(QObject *object, QEvent *event);