Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-03 14:40:55


From: "David B. Held" <dheld_at_[hidden]>
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:008601c1f29a$a7f91990$1d00a8c0_at_pdimov2...
> > [...]
> > [typename] Config::storage_policy::template apply<RightParameter>
> [::type].
> > With templated typedefs that could be simplified to
> >
> > Config::template storage_policy<RightParameter>.
>
> Ok, so if I understand correctly, you turn the templated policies into
> classes by "pushing down" the template parameter(s) into template
> member functions?

Nested class templates, not member functions:

template<class T> struct ref_counted_policy
{
// ...
};

becomes

struct ref_counted_policy
{
    template<class T> struct inner
    {
    // ...
    };
};

so it can be typedef'ed.

Or, if MPL compatibility is desired:

struct ref_counted_policy
{
    template<class T> struct apply
    {
        struct type
        {
        // ...
        };
    };
};


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