I have a question about vector push_back().I am writing a code to acquire image into the buffer and store them inside a vector.I checked that I may need to use push_back(),But I am not sure right now how should I format pImageBuffer that I can store it into the vector.Maybe it is another easy question,but I have been trying a whole morning but still confused.I hope someone can give me some light.Thanks very much in advance!!
the Result.Buffer() is from a camera SDK,it will renew by StreamGrabber.QueueBuffer.My problem is whenever I build I got error like :
std::vector<_Ty>::push_back’: Konvertierung des Parameters 1 von ‘const uint8_t *’ in ‘unsigned char *const &’ not possible
My code is some how like this.
….
std::vector<uint8_t *> images(100);// here is the problem ,it needs a "const",or delete const down const uint8_t *pImageBuffe.Thanks very much guys for your answers!!!
while(1){
....
const uint8_t *pImageBuffer = (uint8_t *) Result.Buffer();// Here I get the image data
images.push_back(pImageBuffer);// This is obvious wrong,but I am not sure in side (),what should I do
StreamGrabber.QueueBuffer(Result.Handle(), NULL);
...
}
You have a
const uint8_t*, but your container storesuint8_t*.Also note that you’re adding a 100th, 101st, 102nd element there, not filling the 0th, 1st, 2nd…
You may want:
Or you may want:
Or you may want combinations without the
const.