]> git.tdb.fi Git - libs/gltk.git/commitdiff
Add a function to find the index of an item in ListDataStore
authorMikko Rasa <tdb@tdb.fi>
Wed, 26 Jun 2013 21:25:52 +0000 (00:25 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 26 Jun 2013 21:25:52 +0000 (00:25 +0300)
source/listdata.h

index 38706f8b1cc9ac64648c8b4a0202034b5e1475c3..094b287b703545c294f71a644b33b5be0032af00 100644 (file)
@@ -55,6 +55,14 @@ public:
                return items[i];
        }
 
+       int find(const T &v) const
+       {
+               for(unsigned i=0; i<items.size(); ++i)
+                       if(items[i]==v)
+                               return i;
+               return -1;
+       }
+
        void remove(unsigned i)
        {
                if(i>=items.size())