Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2003-01-19 20:11:12


Andrei Alexandrescu wrote:

> Back to pbd smart pointers, looks like nobody needs policy-based smart
> pointers coz they're so complex and shared_ptr just works for everybody,
> yet new xyz_ptr classes designed from scratch seem to appear around here
> quite often :o\. I just can't stop remarking how easy they can all be
> implemented as policies of Loki::SmartPtr.

Coming from the standpoint of someone who uses this stuff rather than
writes it <g>

I love Loki, it has some really neat solutions to some very practical
problems. It is at the heart of some of our more important frameworks
here <g>

Modern C++ design is a cracking book, and the chapter on smart pointers
really shows off the potential of policy based design. The loki pointer
looks fantastic.

Yet I always find myself turning to either scoped_ptr (practically
essential with the borland VCL), std::auto_ptr (for returning from
factory-type functions) or shared_ptr (for just about everything else)

The simplicity is simply too big a lure. Although we could tune and
focus our pointers more effectively using policies and Loki, we then
have the complexity of many pointer types running through our code, and
having to remember the nuances of how each one was defined. Using the
basic 3 mentioned above simply cuts out the clutter.

We don't even use the full flexibility in shared_ptr, with deleter
functions, weak_ptr and the like. Maybe our needs are just that bit
simpler than everyone else?

As pointer out previously, named template parameters and template
typedefs would both make a big difference, but I think the Loki pointer
is better today as a driving example of why we need these features than
as something I can use in its own right. It is clearly a fantastic
beast, which is why it makes such a good motivating example <g> If I
can see the utility and still draw back from its use, we (or rather 'the
committee') need to find some way of driving down those barriers.

> Andrei the lurker

Nice to know your still around <g>

-- 
AlisdairM

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