Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2006-04-08 04:52:31

"Martin Bonner" wrote:

> The problem is the code:
> template <typename T1, typename T2>
> class sealed_impl
> {
> friend typename T1;
> friend typename T2;
> ...
> 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 :-(

While this and similar tricks are forbidden by Standard
almost all current compilers are so "buggy"
to support the feature. Comeau has even special switch
to enable the feature.

See article
from Mathew Wilson for overview of these techniques.

Generally, if something useful can be done
because of widely present "bug" it is worth to consider.
Boost.Typeof uses VC6 bug to implement
otherwise impossible typeof there.


Boost list run by bdawes at, gregod at, cpdaniel at, john at