To illustrate my question, I copied below code from the "Phonebook" example of Boost help doc.
struct phonebook_entry
{
std::string family_name;
std::string given_name;
std::string ssn;
std::string phone_number;
}
And I can do a partial search as below
// search for Dorothea White's number
phonebook::iterator it=pb.find(boost::make_tuple("White","Dorothea"));
However, if I need to count the number of people who's family name is "White", then go on to find how many "White"'s have "Dorothea"' as their given name, then what's the best way to do it? I think I can do two partial queries, with pb.find(boost::make_tuple("White") and pb.find(boost::make_tuple("White","Dorothea"). But I am concerned whether this will cause a performance issue? Since the second query has no knowledge of the first query and just search the whole container. Does Boost provide something like below:
std::pair<iterator,iterator> partialResults=pb.equal_range("White");
std::pair<iterator, iterator> partialOfPartial=pb.equal_range("Dorothea", partialResults);
Or is there any smarter way to do this? Not only from convenience point of view, but for performance.