Menu

#395 Fix STAFRefPtr const correctness

All
open
nobody
STAFProc (180)
3
2004-08-20
2004-08-20
No

Currently STAFRefPtr<T> defines all of its "dereference"
operators as const. This however, breaks the const
correctness of the underlying object. An example is in
stafclnt/STAF.cpp. The printObject() function takes a
const STAFObjectPtr &objPtr. That object is then used
like objPtr->get(). Note, the get() method of
STAFObject is not declared const, however, operator->
() of STAFRefPtr<T> is, and it returns a non-const
STAFObject, which removes the const-ness of the
orignal argument.

Fixing this will likely expose some other areas where we
haven't properly managed const correctness, so I don't
think it will be a trivial change. On the upside, there is
the possibility that it could fix some latent issues.

Discussion


Log in to post a comment.