Boost logo

Boost Users :

From: Noah Roberts (roberts.noah_at_[hidden])
Date: 2008-05-16 23:12:42


Nevin ":-]" Liber wrote:

> void foo(int const* p)
> {
> static int const* pp;
> if (p && pp) std::cout << *pp << ' ' << *p << std::endl;
> pp = p;
> }
>
> What should the interface to foo() be such that it doesn't break
> whether or not foo() keeps a copy of p?

You might consider a shared_ptr. Seems like the perfect place for one.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net