Use shared_ptr for the TimeAxisView hierarchy.
[ardour.git] / gtk2_ardour / track_selection.cc
1 #include <algorithm>
2 #include "track_selection.h"
3
4 using namespace std;
5
6 TrackSelection::TrackSelection (list<TimeAxisViewPtr> const &t)
7         : list<TimeAxisViewPtr> (t)
8 {
9
10 }
11
12 list<TimeAxisViewPtr>
13 TrackSelection::add (list<TimeAxisViewPtr> const & t)
14 {
15         list<TimeAxisViewPtr> added;
16
17         for (TrackSelection::const_iterator i = t.begin(); i != t.end(); ++i) {
18                 if (!contains (*i)) {
19                         added.push_back (*i);
20                         push_back (*i);
21                 }
22         }
23
24         return added;
25 }
26
27 bool
28 TrackSelection::contains (TimeAxisViewConstPtr t) const
29 {
30         return find (begin(), end(), t) != end();
31 }