Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-02-25 15:52:31


That's my code, so I should probably say something.

Daryle Walker wrote:
> The problem is in a template parameter description in "random.hpp", lines
> 383 through 391:

[shortened to remove compiler-workaround]

> > // L'Ecuyer 1988
> > template<class MLCG1, class MLCG2, typename MLCG1::result_type val>
> > class additive_combine
>
> The rest of the class template continues from there. The problem is that my
> compiler chokes on the fourth line ("typename MLCG1::result_type") here,
> claiming something like "illegal name overloading."
>
> I guess the problem is an ambiguity between the types of template
> parameters:
>
> 1. A type
> A. "class" [formal_parameter_name ["=" default_value]]
> B. "typename" [formal_parameter_name ["=" default_value]]

> 3. A value
> A. type_name [formal_parameter_name ["=" default_value]]
>
> When using a type name that is within a class template, you have to use the
> "typename outer_type::inner_type" syntax. That is what the writer did here.
> However, this case of 3A also looks like 1B! The compiler is choosing 1B,
> then choking because the formal_parameter isn't a single identifier.

That's exactly the point: The formal_parameter is not a single identifier,
thus it cannot be case 1B. If your compiler is unable to properly
determine this, use the work-around #define. What compiler are you using,
btw.?

> The ironic part is that I'm not using this class, but another from the same
> header. Is this an ambiguity that the original writer's compiler missed, or
> is my compiler wrong?

I believe your compiler has enough information to handle this case, if
it chose to make full use of said information.

Jens Maurer


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