|
Boost : |
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-04-16 13:29:57
AMDG
Phil Bouchard wrote:
> "Steven Watanabe" <watanabesj_at_[hidden]> wrote in message
> news:48061126.40705_at_providere-consulting.com...
>
> [...]
>
>
>> It would also be nice to know what kinds of cycles it doesn't handle.
>>
>
> [...]
>
> 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;
}
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk