Boost logo

Boost :

From: Milutin Jovanovic (miki_at_[hidden])
Date: 2000-05-30 18:14:04


----- Original Message -----
From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
> typedef SmartPtr
> <
> Widget*,
> RefCounted,
> CheckOnDereference
> >
> widget_ptr;

Interesting. I saw a 'policy' class implemented somewhere else, and it was
full of defines. However, your approach seem to use inheritance. That suggests
you actually thought about this :-). I am intrigued. Is it possible to see the
code? It would be easier to discuss this with the work in front of us.

>> And this even does not touch the topic of standardising object
>> access. Imagine if std containers had this configurability. You
>> would
>> not be able to write a reusable piece of code, because depending on
>> your 'policies' container would behave differently.
>
>I'm afraid I don't understand this. If you use the pre-canned
>policies, you get a combination of known behaviours.
>
>By the way, I have a simple mechanism for converting classes that use
>different policies, as long as the conversion makes sense. For
>instance, you can assign checker pointers to checked pointers.

To elaborate my point, any two std containers have similar usages. E.g. you
have a begin(), and you can iterate until end(). So, you can substitute
std::vector for a std::list with minimal changes (if any).

But your classes are different. Changing the template arguments, changes the
programming model almost completely.

Further more, with so many variations it is hard to remember what is the
policy of your current incarnation of the pointer. 'Have I made it
'CheckOnDereference' or not?' Even worse, in an organization of 100
programmers, every one might find a different flavour of the pointer best. So
when you start reading all that code together you will get lost pretty
quickly. My question. What is wrong with having several flavours as standard,
and sticking to them?

But I might be jumping the gun here. If you can provide the smart pointer code
as I asked above, I will look at it seriously. Maybe even write some code that
uses it just to get a practical perspective on this. Then I will be able to
comment much better.

BTW, Dave, thanx for pointing out the allowance in the Boost for some platform
specific code. Hopefully now we will spend some time on the multi threaded
issues.

Cheers,

Miki.


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