
17 May
2008
17 May
'08
3:12 a.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.