If I define a pointer-to-map like this:
map<int, string>* mappings;
mappings is a pointer. How should I use this pointer to operate the map?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the pointer just like you use any other pointer: dereference it to get to the object to which it points.
Remember that
a->bis — mostly — equivalent to(*a).b, then have fun!(Though this equivalence doesn’t hold for access-by-index like
(*a)[b], for which you may not use the->syntax.)