
16 May
2008
16 May
'08
9:12 p.m.
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.