[Ipopt-tickets] [Ipopt] #162: unsave SmartPtr copy semantics, meaningless comparisons, missing conversions
Ipopt
coin-trac at coin-or.org
Sat Mar 30 15:12:14 EDT 2013
#162: unsave SmartPtr copy semantics, meaningless comparisons, missing
conversions
---------------------+----------------------
Reporter: guest | Owner: stefan
Type: defect | Status: closed
Priority: normal | Component: Ipopt
Version: 3.9 | Severity: normal
Resolution: fixed | Keywords: SmartPtr
---------------------+----------------------
Changes (by stefan):
* status: assigned => closed
* resolution: => fixed
Comment:
Thanks for taking the time to have such a deep look into the code and
sorry that this took so long to get back.
r2175 takes care of point 1.
r2176 takes care of point 2. I used the last variant where on casts to
!ReferencedObject*.
r2177 takes care of the first part of point 3, i.e., one can now
initialize/assign with !SmartPtr's to base classes. I did not add the
suggested !StaticPtr and !DynamicPtr methods. I don't think they work,
since the T-type is not part of the functions signature (it only
determines the return type). Also I got a compiler error when I tried it.
We'll see if std::swap requires an additional include on some platform.
r2178 takes care of point 4. I did not include the swap member function.
In the implementation of the free variant, one needs to take care that the
!ReferencedObject class may hold a list of all !SmartPtr's that point to
it, so just swapping the ptr_ members is not sufficient.
Also I did not use std::less to avoid dependency on <functional>.
--
Ticket URL: <https://projects.coin-or.org/ticket/162#comment:2>
Ipopt <http://projects.coin-or.org/Ipopt>
Interior-point optimizer for nonlinear programs.
More information about the Ipopt-tickets
mailing list