
Martin Bonner wrote:
----Original Message---- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Sebastian Redl Sent: 07 April 2006 16:14 To: boost@lists.boost.org 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.