Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2004-07-08 16:34:07


Jonathan Turkanis wrote:
> [...]
> 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;
> };
> };
> [...]

For syntax reasons, this is an undesirable solution. Although,
you could get pretty close by modifying it a little:

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

> [...]
> 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.

The problem is that sp_nested<> would be an implementation detail
that I would not want to expose to the user. So I would not want
the user to have to mention it in order to instantiate less<>.

Dave


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