Hello! On Sat, Sep 27, 2008 at 04:48:03PM +0200, Bruno Haible wrote:
You can introduce a new class, say, cl_UP_coefficients or cl_UP_embryo, that has a set_coeff method and a finalize method that returns a cl_UP. cl_UP will lose these methods, but have a constructor that takes a cl_UP_coefficients argument.
Changing the coefficients is a common operation (think of division, GCD, etc). So this crippled^W immutable cl_UP is next to useless.
2) The other option is to keep the current design and have set_coeff and finalize throw an exception when the reference count is > 1. And, of course, document the behaviour
I think this is the only sane option.
and provide a separate function for "deep copying" of a polynomial.
What about a copy constructor? Best regards, Alexei -- All science is either physics or stamp collecting.