I want to pass the whole set as an argument to a function, like the way we do for arrays (i.e &array[0]). I am not able to figure out how to get the pointer to the raw data for a set.
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.
It is not possible to do it in the same way as an array because
std::setis not required to have it’s data arranged in a contiguous block of memory. It is a binary tree so it most likely consists of linked nodes. But you can pass it by reference, or use thebegin()andend()iterators.