Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2000-05-30 21:03:15


--- In boost_at_[hidden], "Mulligan, Pat" <Pat_Mulligan_at_x> wrote:
> Can I see your implemtnation?

I emailed you a copy of my draft chapter on smart pointers. I cannot
webify it for two reasons: quality and copyright. It's a rough draft
as of now, but I guess it embeds an idea or two.

> I have been invited to write an article of
> one of the rags on smart pointers to stl containers. In general,
my opinion
> is in the KISS camp on this, but if you have the cat in the bag,
I'll gladly
> utilize it.

It's KISS all right. I've rarely seen a simpler implementation. It's
decomposing that's tough. Then taking care of each policy is piece of
cake. But without the code of course that's FUD :o). Just give me
some time and I'll post the whole code. I didn't expect such a quick
and positive response, thanks to all very much.

About threading: threading model in SmartPtr, Singleton etc. is a
policy, which makes things very interesting. Boost can define the
requirements for a threading policy, and implement only the single-
threaded policy. This way boost has no platform-specific code, yet
clients can implement threading policies for their platforms.

Ah, I remember a question about efficiency. SmartPtr and much of my
code is very efficient in the presence of the following optimizations:

* Empty base optimization;
* Unused arguments optimization in conjunction with empty structures;
* Reasonable inlining

If a compiler doesn't do some or all of the following, Loki's
efficiency might degrade. I think these are reasonable optimizations,
though, and if you do have them, SmartPtr's efficiency in size and
speed is the same as the functionally equivalent handcrafted code.

Andrei


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