Why would you need to overload the [] operator? I have never come across a practical scenario where this was necessary. Can somebody tell me a practical use case for this.
Share
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.
Err..
std::vector<t>,std::basic_string<t>,std::map<k, v>, andstd::deque<t>?I used this for a class representing a registry key, where
operator[]returned an object representing a registry value with the string between []s.See also, the Spirit Parser Framework, which uses [] for semantic actions.