Open hansenjo opened 9 months ago
The operator=, operator+, and operator- functions are written to act on the event-level data and not on the initialization data. The idea is to allow arithmetic of different channels together, like newbcm = bcm1 + bcm2.
Ah, yes, I realized this recently as well. A bit of "unexpected behavior" when one comes from standard C++, but certainly an interesting design. The question the is, does the copy constructor work differently from operator=? If it does, odd things may happen in the code:
A a1 = b;
A a2(b);
Will these two lines give different results? I'll let this sink into my mind for a while.
My recent fix in the japan repo related to copying C-arrays in constructors was updated here: The C-arrays in the japan classes were replaced with
std::array
objects. Good.Now, with this replacement done, I think you don't need the workaround with the
QwCopyArray
function anymore since, unlike C-arrays,std::array
can be initialized via copy construction from anotherstd::array
(same size and element type assumed).If you then still have a problem with
operator=
assignment, then I'd suspect a design flaw in the classes involved. Shouldn't an assignmenta = b
give you ana
that is (functionally) equal tob
?