Skip to content

Instantly share code, notes, and snippets.

@phaustin
Created April 3, 2019 02:33
Show Gist options
  • Select an option

  • Save phaustin/4acfc8bedbcfab58da28b68be83329c9 to your computer and use it in GitHub Desktop.

Select an option

Save phaustin/4acfc8bedbcfab58da28b68be83329c9 to your computer and use it in GitHub Desktop.
histogram pybind11
ndbecker @nbecker 05:38
question. In my histogramndx class with code here
https://gist.github.com/nbecker/26704ae6a29a17de1bb3988cb2be4bfd
In the 'resize' method, a newhistogram is constructed, and finally
*this = newhistogram
is used. I have default move constructor/assignment. Should this perform move on all the members? In particular, the 'buckets' member could be a large array. I'd prefer to move from the newhistogram buckets to the existing member rather than copy, but I can't tell if this is working.
Johan Mabille @JohanMabille 05:40
newhistogram is an lvalue here, so you have to make an explicit call to move
i.e . *this = std::move(newhistogram)
the behavior of the default move assignment operator is to move every member that is movable
and copy the others
(not sure about that last statement actually)
let me check ;)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment