The contrived example below illustrates a problem that I'm having.
Running with VS2003, built in unmanaged debug mode, the second
anA.SetPtr(aB)
encounters an error "...has requested the Runtime to terminate it in an unusual way..."
What am I doing wrong?
#include "boost/smart_ptr.hpp"
class A;
class B {
public:
void SetPtr(A& anA) {
pA.reset<A>(&anA);
}
private:
boost::shared_ptr<A> pA;
};
class A {
public:
void SetPtr(B& b) {
b.SetPtr(*this);
}
};
int main() {
A anA;
B aB;
anA.SetPtr(aB);
anA.SetPtr(aB);
}
Start Free Trial