Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-10-07 23:22:25


David B. Held wrote:
> I also see that my idea of making a 'metafunction
> base class' is not going to work as hoped. I thought it
> might be nice to have something like this:
>
> template <class Policy>
> struct ownership_policy
> {
> typedef typename Policy::type type; // Doesn't work
> typedef ownership_policy_tag policy_category;
> };
>
> template <typename T>
> struct ref_counted
> : public ownership_policy<ref_counted<_>::type> // Bad
> {
> // ...
> };

Hhm, how about this one:

    template< typename Policy >
    struct ownership_policy
    {
        typedef Policy type;
        typedef ownership_policy_tag policy_category;
    };

    template< typename T >
    struct ref_counted
        : ownership_policy< ref_counted<T> >
    {
        // ...
    };

?

Aleksey


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