|
Boost : |
From: Vladislav Lazarenko (snail_at_[hidden])
Date: 2006-04-07 12:36:31
Martin Bonner wrote:
> ----Original Message----
> From: boost-bounces_at_[hidden]
> [mailto:boost-bounces_at_[hidden]] On Behalf Of Sebastian Redl
> Sent: 07 April 2006 16:14 To: boost_at_[hidden]
> Subject: Re: [boost] Sealed C++ class.
>
> If I write
> class Broken : public UniquePerson {};
> Then the constructor of Broken has to invoke the constructor of
> sealed_impl. However the constructor is private, so it can't. The
> result is a compilation error.
>
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk