Boost logo

Boost :

From: Sean Parent (sparent_at_[hidden])
Date: 2008-07-20 01:46:51


I think there are two separate notions being discussed here -

First is the notion of a partial function - assignment and copy are
both partial functions and have a precondition that the rvalue be in a
valid state.

The second is the notion of a runtime type where once the type is
determined it is fixed and assignment becomes defined only on items of
the same type. I tend to shy away from
implementing such types and usually prefer to document that
assignment won't throw
(perhaps unless some subtype throws) if the two objects are of the
same runtime type (or have the same topology - or whatever a correct
term would be for the circumstance).

There are cases where I think the notion of a runtime type is valid
even when it makes assignment more partial than it would be otherwise
- being partial doesn't effect the concept at all - but such a design
choice should be weighed carefully.

Sean


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