|
Boost Users : |
From: Alan M. Carroll (amc_at_[hidden])
Date: 2008-07-31 08:18:45
At 04:57 PM 7/30/2008, you wrote:
>Compared to mine, better sides:
>Worse sides:
>1. No thread safety (may be you do not need it, but i need).
>2. No const awareness, i think the following will fail:
> boost::intrusive_ptr<const test> p(new test);
> boost::intrusive_ptr<const test> q(new test);
> p = q;
>3.m_reference_count is visible to derived classes.
1) Yes, but as you note it's trivial to add if it's important. I had that in my own implementation of intrusive_ptr (before those were in Boost) but dropped it because I never used it. Not such a big deal on Win32, but I remember it being painful on Sun / Sparc systems (am I dating myself?).
2) Interesting. I have been using this code for years and not had that come up. I'll have to take a look.
3) A design feature for me. It makes copy on write semantics easier to implement. You might consider putting in "bool is_shared() const { return m_reference_counter > 1; }" for that case.
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