Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-10-11 09:48:16


Victor Morilla wrote:
> Peter Dimov wrote:
>
>> Victor Morilla wrote:
>>>
>>> template <typename FnType, FnType* fn>
>>> struct Translator<FnType, fn, 0> :
>>> function_traits<FnType>
>>> {
>>> typedef result_type type;
>
>> typedef typename
> function_traits<FnType>::result_type type;
>
>>> };
>
> The question is, why result_type type definition is
> not inherited from function_traits ?

Members of dependent base classes are not visible in this context, because
at the time the definition of Translator<FnType, fn, 0> is parsed,
function_traits<FnType> is not instantiated (FnType isn't known until
Translator<> is instantiated). When 'result_type' is encountered at
definition time, the compiler does a normal lookup. If you add a global
result_type definition, it will be found.

The base class definition of result_type is inherited, though.
Translator<int(), &f>::result_type will work.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net