Is there an algorithm or helper method in the boost library to search a vector of boost::tuple
objects? Here is my code:
typedef boost::tuple<int, char const*, char const*> Tuple;
typedef std::vector<Tuple> ErrorStringMap;
ErrorStringMap mystrings = tuple_list_of
(10, "10", "ten")
(20, "20", "twenty")
(30, "30", "thirty")
(40, "40", "fourty");
I want to search the vector of tuples and find the first tuple with the value 20 as the first element in the tuple. I want to access that tuple's 2nd and 3rd elements.
ildjarn answered this in the list of comments below my question, however he did not post as an answer, so I will do it for him:
Phoenix's placeholders are in boost::phoenix::placeholders. Also, if you're using Phoenix, you don't need bind for this -- with the proper includes, at_c<0>(_1) == 20 works.