I have vector of structures like this:
struct myStructure {
int x;
};
vector <myStructure> vectorOfMyStructures;
then I push some (many) of my structures to this vector. Next think I do is declaring vector of pairs of those structures:
vector < pair<myStructure, myStructure> > *vectorOfPairsOfMyStructures;
the thing I want to achieve is declaring this vector of pairs to store only references to original structures in first vector (I will have line n^2 of those pairs), but following approach does not work:
vectorOfPairsOfMyStructures->push_back(make_pair(&myStructure1, &myStructure2));
How can I properly declare and add to vector of pairs of references of structures?
Why not duplicate?
1. I want to put references of structures to pair, not vector
2. I operate on c++ 98 (cannot use reference_wrapper)