How to use structures as keys in maps

(Rohik Galli) #1

I am trying to use structure (which contains pointers ) as key in map , I want to map based on the values of structure but, I am not getting expected results.
here is sample code

please help me…

( Kvaz1r) #2

Well your ro is a pointer so it will have different adress on each iteration.

(Rohik Galli) #3

Is there any way to get expected result

( Kvaz1r) #4

Don’t use pointers

(Rohik Galli) #5

Thanks ,
Actually I made simple change i.e I concatenated all the values of struct fields as string and used this string as a key.I got expected results.:blush: