#STL question

38 messages · Page 1 of 1 (latest)

atomic krakenBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

dusk quartz
tribal creek
#

can you give me any hint?

#

because i have spent a lot time and still havn't got the idea

#

the problem is how i supposed to search with struct field?

#
int count = cpis...........(checkCpi)
#

in this line

#

im searching whole struct in multimap

#

but key is of type double

dusk quartz
#

well I think youre likely looking for multiset instead then since youre searching for whole Students not just a specific part

#

although honestly this question isnt great

#

But yeah multiset and then count and find

tribal creek
dusk quartz
#

its unclear how a specific comparison works between Students though

#

Do students compare equal ignoring the name?

tribal creek
#

i suppose

#

that's why there is a empty struct with cpi only?

#

i guess

dusk quartz
#

If they do then multiset is probably the way. Although with those you can actually specify an equality operator for multiset as part of the template parameters

tribal creek
#

ohhhhhh lemme try that

#

i can pass lambda right?

dusk quartz
#

I doubt they want that though since it doesnt fit the answer structure

tribal creek
tribal creek
#

is this correct?

#

but how i suppose to use count with checkCpi

#

nvm this question is bad

#

thank you for your response!

atomic krakenBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity

dusk quartz
#

youre not mapping the cpi

#

well you are

#

but the way they are doing it is via a set

tribal creek
dusk quartz
#

and suddenly all the operations make sense