Yes, standard object warranties are being destroyed in the order in which they were created. The reason is that one object can use another, so it depends on it. Consider:
struct A { }; struct B { A &a; B(A& a) : a(a) { } }; int main() { A a; B b(a); }
If a needed to be destroyed before b , then b would contain an invalid element reference. By destroying objects in the reverse order in which they were created, we guarantee the correct destruction.
wilhelmtell Feb 12 '10 at 19:04 2010-02-12 19:04
source share