Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2006-07-06 22:24:30


Gennaro Prota <gennaro_prota_at_[hidden]> writes:

[...]

| template<class T>
| class final
| {
| private:
| final() { }
| friend class T;
| };
|
| I'd add another base class to this so that the user hadn't to remember
| to write virtual, but that's not the main point. In any case, this
| does not prevent derivation: it prevents *instantiating* any derived
| class (so a derived class which would only have static members... :)).
|
| It will probably get into boost when "friend class T" will become
| legal;

     friend T;

has been voted into the current draft of C++, i.e. it is now possible to
declare a template parameter as a friend. You're right that it is
not widely supported yet.

-- Gaby


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