// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_vfind #define tools_vfind #include #include namespace tools { template inline T* find_named(const std::vector& a_vec,const std::string& a_name) { typedef typename std::vector::const_iterator it_t; it_t it; for(it=a_vec.begin();it!=a_vec.end();++it) { if((*it)->name()==a_name) return *it; } return 0; } /* template inline const T* find_named_(const std::vector& a_vec, const std::string& a_name) { typedef typename std::vector::const_iterator it_t; it_t it; for(it=a_vec.begin();it!=a_vec.end();++it) { if((*it).name()==a_name) return &(*it); } return 0; } */ } #endif