vector of arrays of pointers to structures
I have a function as below:
Where Blob is a simple structure.
void f ( std::vector<Blob> *blobsPtr )
// create the vector to store every pair of pointers to Blobs
// create a vector of pairs of Blob pointers, total of (num of Blobs choose 2)
for (vector<Blob>::size_type i = 0; i < blobsPtr->size() - 1; i++)
for (vector<Blob>::size_type j = 0; j < blobsPtr->size(); j++)
const Blob *b;
b = &(blobsPtr->at(i));
b = &(blobsPtr->at(j));
// examine each pair and remove ones that fail the test
The goal of the function is to take all of the elements in the vector referenced by blobsPtr, and first create a vector of pairs of pointers to Blobs. In other words, create a vector that has every pairwise combination of Blobs (as pointers). Then I want to do some tests and remove the elements of 'pairs' that fail the tests. Finally, I want to delete all the Blobs that failed the test from the vector pointed to by 'blobsPtr'.
The error I am getting with the current version is "cannot convert parameter 1 from 'const Blob *' to 'Blob *const (&)" when I try to do the push_back.
I'm starting to get confused, so any help would be appreciated. Or perhaps I'm going about this totally wrong. The thing is I don't want to copy all the Blobs when I'm creating the pairwise vector, because it's just a waste of memory.