Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-07-08 16:26:37


"David B. Held" <dheld_at_[hidden]> wrote in message
news:cck1t5$g3r$1_at_sea.gmane.org...
> This is what I would like to do:
>
> template <class P1, class P2>
> struct sp
> {
> template <typename T>
> struct nested { };
> };
>
> template <typename T>
> struct less;
>
> template <class P1, class P2, typename T>
> struct less<sp<P1, P2>::nested<T> >
> : binary_function<...>
> {
> bool operator()(...);
> };
>

Could you pull the definition of nested outside of sp

    template<typename P1, typename P2, typename T>
    struct sp_nested { };

then use a metafunction within sp:

    template<typename P1, typename P2>
    struct sp {
         template<typename T>
         struct nested {
             typedef sp_nested<P1, P2, T> type;
         };
    };

?

You can then make less< sp_nested<P1, P2, T> > do pretty much whatever
you want; the question is whether you can make the metafunction do
whatever you needed the nested template to do.

Jonathan


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