octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #59500] sub-classes of octave_base_value aren'


From: Rik
Subject: [Octave-bug-tracker] [bug #59500] sub-classes of octave_base_value aren't assignable
Date: Fri, 27 Nov 2020 12:13:04 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36

Follow-up Comment #7, bug #59500 (project octave):

Can copy assignment operator declared at the octave_base_value level actually
work?  Multiple classes inherit from octave_base_value and the class itself is
mostly virtual methods meant to be re-defined.  As an example,
octave_base_scalar and octave_base_diag both inherit from octave_base_value().
 Assuming copy assignment at octave_base_value is what you defined


octave_base_value& operator = (const octave_base_value&) { return *this; }


then this should theoretically compile


octave_base_scalar a;
octave_base_diag b;

a = b;


But, I don't see how it would work because octave_base_scalar only has room
for one value and b requires a matrix worth of storage.

Would it make sense to define copy assignment at the leaf classes instead? 
That way an octave_scalar_value<double> could be assigned to an
octave_scalar_value<double> but if the assignment was across classes, such as
octave_scalar_value<int>, a new value would have to be created.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59500>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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