Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2004-07-08 13:44:28


On 07/08/2004 12:58 PM, David B. Held wrote:
> 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()(...);
> };
>
> However, it doesn't work. From my research, it seems that the
> problem is that T is in a non-deduced context, but I don't see
> why that would be an issue, since this is how I expect it to get
> instantiated:
>
> less<sp<p1, p2>::nested<int> > comp;
>
> Thus, I don't see any deduction as being necessary, but obviously
> I don't exactly understand how to get what I want.

I very much sympathize with you; however, I have no answers :(
I went through the same confusion with my managed_ptr's nested ownership
template class. It was discussed here:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=1044dnuf7ojhpc0%40corp.supernews.com

In the above, David Abraham also expressed surprise at the need for
deduction. A proposed standard change was also discussed here:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=1072lb8ira3jg41%40corp.supernews.com

However, there was no acknowledgement that it would work :(


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