Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

find a member variable in a vector of objects cpp

//Using a standard functor

struct MatchString
{
 MatchString(const std::string& s) : s_(s) {}
 bool operator()(const Type& obj) const
 {
   return obj.getName() == s_;
 }
 private:
   const std::string& s_;
};
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #member #variable #vector #objects #cpp
ADD COMMENT
Topic
Name
8+6 =