Can I delete a member of vector that is pointed by a pointer?

I have following:

struct Point {int* a; int b;};
vector<vector<Point> > numbers;
vector<int> example;

The numbers vector has a matrix of a sort and each of the members are pointing to one member in the example vector. A member is pointing at Now, can I remotely delete a member in the example vector using the pointers? Like so:

delete (*(;

I know there is a more convenient way to delete members, but this is a very specific case I'm working on.
Last edited on
Your design sounds like a recipe for disaster. Your pointers into example may be invalidated when example grows. They may find themselves pointing at different or non-existent elements if any element of example is erased.

If a points to an element of example, you may not use delete as the element wasn't allocated via new.
Yeah, I figured as much. Might as well do a complete overhaul.
For this, I didn't go deeply but maybe it could be convenient to use a SmartPointer to a Point, instead of using a direct Point.
Topic archived. No new replies allowed.