Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-12-10 07:54:26


Peder Holt wrote:
> On Fri, 10 Dec 2004 03:50:58 -0700, Larry Evans
> <cppljevans_at_[hidden]> wrote:
>> On 12/10/2004 03:25 AM, Larry Evans wrote:
>>>
>>> where the problem with typedef's is mentioned as the show-stopper.
>>
>> Actually, Rani Sharoni's post in that thread is the best explanation
>> I've seen to date.
>>
>
> Still, the problem in his post applies to typedefs.
> If A<T>::B is a nested class or struct under A<T>, and not a typedef,
> deduction should always be possible.
>
> In the case where B is a typedef:
> typedef typename some_class<T> B;
> you can deduce some_class<T> instead of A<T>::B

No, you can't. Given some_class<V> as input to the pattern A<T>::B, you have
no way to deduce T.

template<class T> struct A
{
    typedef typename arbitrarily_complex_metafunction<T>::type B;
};

And of course getting back to iterators, you have no way of determining
whether T* is T*, vector<T, A>::iterator, or basic_string<T, Tr,
A>::iterator, much less deducing A or Tr.


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