From: Joel Holdsworth Date: Mon, 1 Sep 2014 20:56:56 +0000 (+0100) Subject: View: Simplified get_traces X-Git-Tag: pulseview-0.3.0~486 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a2321722dc5a2bade721a73551014908aff4cb4c;p=pulseview.git View: Simplified get_traces --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 305031eb..388c4c49 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -43,6 +43,7 @@ #include "pv/data/logicsnapshot.h" using pv::data::SignalData; +using std::back_inserter; using std::deque; using std::list; using std::max; @@ -242,21 +243,16 @@ void View::set_scale_offset(double scale, double offset) vector< shared_ptr > View::get_traces() const { + vector< shared_ptr > traces; + const vector< shared_ptr > sigs( session().get_signals()); + copy(sigs.begin(), sigs.end(), back_inserter(traces)); + #ifdef ENABLE_DECODE const vector< shared_ptr > decode_sigs( session().get_decode_signals()); - vector< shared_ptr > traces( - sigs.size() + decode_sigs.size()); -#else - vector< shared_ptr > traces(sigs.size()); -#endif - - auto i = traces.begin(); - i = copy(sigs.begin(), sigs.end(), i); -#ifdef ENABLE_DECODE - i = copy(decode_sigs.begin(), decode_sigs.end(), i); + copy(decode_sigs.begin(), decode_sigs.end(), back_inserter(traces)); #endif stable_sort(traces.begin(), traces.end(),