Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2002-05-01 12:11:44


Hi,

Under the slogan: "do not make design decisions" I am inclining to admit
that we do need one more level of indirection. So the step in this direction
would be to introduce policies mixer/builder/adaptor or simply Policies as
just one policy template argument:

template<typename Policies>
class basic_smart_ptr : Policies {
};

This will accommodate most of other designs. But by default we will use
mi_policies_adaptor, like this:

template<typename StoragePolicy,...>
typedef
basic_smart_ptr<mi_policies_adaptor<StoragePolicy,OwnershipPolicy,...> >
smart_ptr;

where mi_policies_adaptor is defined like this:

template<typename StoragePolicy,...>
struct mi_policies_adaptor : StoragePolicy, OwnershipPolicy
{
};

mi_policies_adaptor does not incur any restriction to policies. All our
predefined policy will work with this way. We may also provide
chaining_policies_adaptor (I do not think we need more powerful inheritance
generator facility since we now list of our types ahead of time):
To make our predefined policies work with chaining_policies_adaptor we
could provide chaining_adaptor.

template<template Policy, template Base>
struct chaining_adaptor : Policy, Base
{};

template<typename StoragePolicy,...>
struct chaining_policies_adaptor : chaining_adaptor<StoragePolicy,
chaining_adaptor<OwnershipPolicy, ....> > > >
{
};

This wont make hierarchy linear though.

Everybody are free to invent their own adaptors strategy, to handle any
compiler issues. But generic framework we should try to keep simple.

Regards,

Gennadiy.


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