...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
Q: /I have an object composed of 12 doubles.
to this object is returned by a member function of another class. From the
viewpoint of using the returned object in Python I do not care if I get a
copy or a reference to the returned object. In Boost.Python I have the choice
Are there considerations that would lead me to prefer one over the other,
such as size of generated code or memory overhead?/
will make an instance with storage for one of your objects,
size = base_size + 12 * sizeof(double).
will make an instance with storage for a pointer to one of your objects,
it will also create a weak reference object which goes in the source object's
weakreflist and a special callback object to manage the lifetime of the internally-referenced
object. My guess?
is your friend here, resulting in less overall memory use and less fragmentation,
also probably fewer total cycles.