「view this page in B3 βῆτα server」

Revisions №223

branch: release 「№223」
Commited by: Andrew Leaver-Fay
GitHub commit link: 「d8f9b4a90a8f2caa」
Difference from previous tested commit:  code diff
Commit date: 2019-05-30 13:47:16

Fix EnergyMap::operator += (#3977) The convention for increment-and-assign type operators is to return a reference to the object that has just been incremented, thereby facilitating multiple increments in a single statement ``` a += ( b+= c ); ``` The original author* of the EMapVector class (aka EnergyMap) did not realize this and so this class does not return a reference, and instead returns void. This has never been a problem for C++ code as no one has seemingly wanted to chain increment-and-assign operations. PyBind11, however, will take the returned type and assign it to the original object: ``` emap1 += emap2 ``` is interpretted as: ``` emap1 = (emap1 += emap2) ``` so that this code: ``` emap1 += emap2 print("Surpise!", emap1) ``` will print ``` Surprise! None ``` This PR changes the signature of just the EMapVector's operator+= and similar methods, but surely there are other places in the code where operators are not conforming to the C++ conventions. *I am the original author of this code.

...