I've got
std::vector<unsigned char> data = {0x00,0x00,0x00,0x01};
- the function I'm passing this to requires unsigned char *
- I do the following : unsigned char * converted = static_cast<unsigned char*>(data.data());
and I then pass converted to the function. I'll be using that extensively throughout the code. I prefer to work with vectors as I find them easier to handle. Now the question is - is that cast safe - I mean can I count on it that it'll always work or is it a slow or a bad approach? If so, what's a better way to do it?
regards.