Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-19 14:37:30


From: "Dave Harris" <brangdon_at_[hidden]>
> I use AddRef/Release instead of add_ref/release. My names are compatible
> with Microsoft's OLE, a parochial concern which boost probably does not
> share. I'd gladly change them. If we use non-member functions, adapter
> functions like:
>
> inline void add_ref( MyIntrusiveBaseClass *p ) {
> p->AddRef();
> }
>
> may help, too. I doubt there will be any problem.

Good idea, thank you. I have added an experimental boost/intrusive_ptr.hpp
to the CVS. A simple demonstration:

#include <boost/shared_ptr.hpp>
#include <boost/intrusive_ptr.hpp>

#include <iostream>

struct X: public boost::counted_base
{
 X(): boost::counted_base(0, 0)
 {
  std::cout << "X::X()\n";
 }

 ~X()
 {
  std::cout << "X::~X()\n";
 }
};

int main()
{
 boost::intrusive_ptr<X> px(new X);
 boost::intrusive_ptr<X> px2(px);
 boost::shared_ptr<X> px3(px2);

 px = 0;
 px2 = 0;
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk