|
Boost : |
From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2006-04-07 12:57:17
Vladislav Lazarenko <snail_at_[hidden]> writes:
> Martin Bonner wrote:
>> The problem is the code:
>> template <typename T1, typename T2>
>> class sealed_impl
>> {
>> friend typename T1;
>> friend typename T2;
>> ...
>>
>> 7.1.5.3 p2 says "[Note: this implies that, within a class template with
>> a template type-parameter T, the declaration friend class T; is
>> ill-formed.]"
>>
>> In other words, you can't do that :-(
>>
>
> You are absolutely right. The only thing I am confused with is error
> description. The Boost is used not only by advanced developers, but by mid-level
> too. So when they will see such description it will be very difficult to find
> the real reason of error. Maybe I need just to put more comments in the header
> they will probably check.
I proposed a similar thing on comp.std.c++ in 2001:
Unfortunately the declaration "friend typename T", is not legal. It might
happen to work on current releases of Microsoft compilers, but that's a bug in
the compiler.
Anthony
-- Anthony Williams Software Developer Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk