Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2006-05-26 06:25:34

Gerhard Wesp Sent:

> On Thu, May 25, 2006 at 04:41:32PM +0200, Maarten Kronenburg wrote:
>> Users can implement an unsigned_integer by deriving from
>> integer, but this will not give any performance gain.
> This would violate Item 32 in Effective C++, 3rd ed. by Scott Meyers:
> Make sure public inheritance models "is-a".

I agree it's not a good idea.

> I suggest deriving from integer be disallowed in the TR2 proposal.

... however I don't think that is. If C++ had "final", then it could be
compile time checked. As it is, I don't think TR2 could do more than
make it undefined behaviour. We really don't want more undefined
behaviour in C++ if we can avoid it. What is more, deriving from
integer would actually work on all implementations (as far as public
inheritance which doesn't model "is-a" works).

Martin Bonner
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 203894

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