Boost logo

Boost :

Subject: Re: [boost] [Review] Polynomial library review begins today
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-03-10 11:45:34


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 10 March 2009, Neal Becker wrote:
> 2) """
> Modification from std::vector:
> polynomial<FieldType>& operator=(std::vector<FieldType>& c);
>
> This function uses the nested std::vector::swap() function. The c vector
> should contain new coefficients.
> """
>
> Does this mean that the vector 'c' is modified? I can't accept this. This
> really violates the principle of least surprise. Noone expects an
> operator= to act like that.

I agree with Neal. By the way, there is also a copy constructor with the same
problem. Perhaps the operator= overload for std::vector should be renamed to
something like "move_from" until a move emulation library gets added into
boost? Or, only real moves using rvalue references should be supported.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkm2ix8ACgkQ5vihyNWuA4WsfwCg1caMvHYK+CKngKcRMZv8JMzH
G/QAnAjAPW4Wr9cs4QNoMI+fdDNB97ad
=7ycd
-----END PGP SIGNATURE-----


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