inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_vfind 00005 #define inlib_vfind 00006 00007 #include <vector> 00008 #include <string> 00009 00010 namespace inlib { 00011 00012 template <class T> 00013 inline T* find_named(const std::vector<T*>& a_vec,const std::string& a_name) { 00014 typedef typename std::vector<T*>::const_iterator it_t; 00015 it_t it; 00016 for(it=a_vec.begin();it!=a_vec.end();++it) { 00017 if((*it)->name()==a_name) return *it; 00018 } 00019 return 0; 00020 } 00021 00022 } 00023 00024 #endif