Use a shared_ptr for SessionPlaylists so that it can be explicitly destroyed in ...
[ardour.git] / gtk2_ardour / track_selection.cc
index 3e428b1a940bca61f78832131a5495b7637b3e2e..d9c7f02e19b00ceabff2539a0666113ce24a0fac 100755 (executable)
@@ -3,13 +3,19 @@
 
 using namespace std;
 
+TrackSelection::TrackSelection (list<TimeAxisView*> const &t)
+       : list<TimeAxisView*> (t)
+{
+
+}
+
 list<TimeAxisView*>
 TrackSelection::add (list<TimeAxisView*> const & t)
 {
        list<TimeAxisView*> added;
 
        for (TrackSelection::const_iterator i = t.begin(); i != t.end(); ++i) {
-               if (find (begin(), end(), *i) == end()) {
+               if (!contains (*i)) {
                        added.push_back (*i);
                        push_back (*i);
                }
@@ -17,3 +23,9 @@ TrackSelection::add (list<TimeAxisView*> const & t)
 
        return added;
 }
+
+bool
+TrackSelection::contains (TimeAxisView const * t) const
+{
+       return find (begin(), end(), t) != end();
+}