Multimap object as key, searching via a variable value in the object used as key

This is somewhat simillar to the archieved thread:
"search based on two keys" by mikej

I am using a cutom date class with the following variables:
int day;
int month;
int year;

This class is now used as a key for a multimap.

I need to be able to search for all values where the the key contains a certain month/year combination. So I am thinking of creating a temp date object with the wanted month and year and using it to check against the month/year of the keys.

I was wondering if I equal_range would work? Or if I use copy_if or find_if can this check against the key?

Thank you.
A link to that thread would be appreciated.

¿What do you intend to use with equal_range()?
Suppose that your object has the month and year that you are looking for
You'll lower_bound() with it to find the first occurrence within that time but you'll need to upper_bound() with a bigger month to find the last one.

Keep in mind that the range may be empty.
Topic archived. No new replies allowed.