#ifndef INTROSPECTH #define INTROSPECTH #include using namespace std; class introspect { const introspect *const p; public: introspect(): p(this) {} introspect(const introspect&): p(this) {} introspect& operator=(const introspect&) {return *this;} friend ostream& operator<<(ostream& ost, const introspect& i) { return ost << "introspect at address " << &i << " contains " << i.p; } ~introspect() { if (p != this) { cerr << "Invariant disrupted: " << *this << "\n"; } } }; #endif