octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: octave_base_value::print const-ness and method overload


From: Michael Goffioul
Subject: Re: octave_base_value::print const-ness and method overload
Date: Mon, 27 Jan 2014 07:28:34 -0500

On Mon, Jan 27, 2014 at 2:48 AM, John W. Eaton <address@hidden> wrote:
On 01/25/2014 05:00 PM, Michael Goffioul wrote:
Hi John,

Would you mind having a quick look at the patch attached? This
implements disp/display overload in classdef, by using the following
mapping:
- print -> disp
- print_with_name -> display

There's a ugly hack in octave_classdef::print due to the const-ness of
the method. Not really proud of it, but it was more a proof of concept.
The question is whether it would be better to remove the const-ness of
the method (as for print_with_name) instead?

Hmm.  It seems like it would be better to have more const methods rather than fewer and it makes sense to me that this print method should be const since it is not changing the object, just displaying it.  Would it be better to make the reference count mutable?  Or would that get us into trouble in some other ways?

I thought also about that solution, but that's only part of the problem. You're still unable to compile, because you can't call the private constructor octave_value(const octave_base_value*).

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]