mercredi 17 février 2016

Elements of container removing itselves?

I have a class:

class C1 {
    std::vector<C2> vec;
};

I'd like to implement C1 and C2 class that element in vector (of C2 class) can cause removing itself from container vec. How to do this best?

Maybe I can pass reference to C1 class to C2 class and call method in C1 to remove this element. Is it nice solution? How to do that in C++11?

(C1 is the only one class in the program)

Aucun commentaire:

Enregistrer un commentaire