Boost logo

Boost :

Subject: [boost] Is there a way to specialize how a smart_ptr<T> releases the T?
From: David Hagood (david.hagood_at_[hidden])
Date: 2012-10-23 21:31:58


I am trying to wrapper around a C library (specifically, libxml2) so
that I can use it within a C++ program. (yes, I am aware of libxml++ -
but it doesn't play nice with libxslt).

If the core libxml2 objects were internally reference counted, I could
use an intrusive_ptr, and have the friend intrusive_ptr_release call
libxml2's release function, and all would be well - but unfortunately
libxml2 does not internally reference count the objects (at least, not
in a way I have seen).

If there were a way to specialize smart_ptr<T> such that instead of the
destructor calling delete(), it called what I wanted, I'd be set, but I
see no way to easily specialize smart_ptr<xmlDoc> in that way - or am I
missing something?


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