
"Steven Watanabe" <watanabesj@gmail.com> wrote in message news:48063795.5050100@providere-consulting.com... [...]
Sorry for the quick email... I have to go but it clears everything up the heap, there is no possible cyclicism.
really?
#include <boost/shifted_ptr.hpp>
#include <vector> #include <iostream>
static int count;
struct X { X() { ++count; } ~X() { --count; } X(const X& other) : vec(other.vec) { ++count; } std::vector<boost::shifted_ptr<X> > vec; };
int main() { { boost::shifted_ptr<X> x = boost::new_sh<X>(); x->vec.push_back(x); } std::cout << count << std::endl; }
Ok that's a good point. My routines delimits the heap segment using an overriden owned<>::operator new. If this operator new isn't used then shifted_ptr will think the object resides on the stack or data frames; vector<> uses the global operator new. I'll figure out something else. I have discovered also another bug related to the set counter. Now Vault contains the corrected version. Regards, -Phil