I have a question about converting from std::vector to an array. I have a vector of pointers to object. How can I convert it to an array of pointer to objects in C++?
The vector is
std::vector<pin*> *_PINS
I want to convert it to
pin** pins_arr
I've tried everything that has been suggested in here but it doesn't work
I guess the reason why it's not working is because I have pointer to object as a type instead of basic type.
Would you please help me with this? I've been stucked for the whole morning.
Thank you,
_PINS->data()doesn't work, try& (*_PINS)[0], which is the C++03 version of the same thing._PINSis an illegal identifier. It's better to avoid leading underscores, and (in my opinion) capitals in general. An underscore followed by a capital is reserved for the system, and the compiler might give you warning messages.