|
Boost : |
From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-04-17 17:31:31
Hi Peter,
you wrote:
> > The precondition, that the sizes of the matrices shall be identical, is
> > checked, because swap() is used in assign_temporary(). May be, we could
> > move the precondition checks to assign_temporary().
>
> If they are needed there, I'd move them.
>
> >
> > But swap() for matrix views like matrix_range<> is intended to have deep
> > semantics similar to assignment, i.e. swap() should swap the elements of
> > the referenced matrices, but not the views. Here the precondition seems
to
> > be reasonable.
>
> Mmhh, why ? SInce the views are references to parts of a matrix,
> I'd expect them to change after calling swap().
>
> > So the interesting question arises, whether container and views should
> > require the same precondition on swap() or container's swap() should be
> > allowed to swap different sized matrices, too.
>
> Container should be allowed to swap to different sized matrices, since
> that's what we're used from STL.
OTOH, in a generic algorithm one shouldn't care to use a matrix container or
a matrix view. May be, the main question is: what do you need to achieve
with matrix::swap?
Best regards
Joerg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk