-
Notifications
You must be signed in to change notification settings - Fork 48
Improve exception safety with smart pointers #311
Comments
I agree with you. Nevertheless we do not plan on updating the code to C++11 in one big bang. Rather each time some code is modified, it is updated in the same time. I will mark this enhancement as trivial. Maybe a newcomer will pick it up. |
Hello everyone |
Hi, @divserge. Is it still relevant and you are welcome to tackle it; thanks! |
I took a quick look at this, starting at CParameterMgr and working upwards changing the necessary parameters/member variables. However, I hit an issue when hitting ConfigurableElementAggregator.cpp whereby it defines the following function pointer typedef (in .h): typedef bool (CConfigurableElement::*MatchesAggregationCriterion)() const; The issue being that in if the parameter for the doAggregate function is changed from a const * CConfigurableElement to a const std::unique_ptr then the function pointer dereferencing here: if(!(pConfigurableElement->*_pfnMatchesAggregationCriterion)()) fails to work (as far as I can tell, because the ->* operator has not been defined properly for smart pointers...yet). The only other option I can see (though someone with better C++ will probably have something better) is to use shared pointers instead - then for this doAggregate issue in particular, presumably a raw pointer could also be created to the object (which in turn could then be used as in the code right now). Not ideal, but haven't got any other ideas off the top of my head. Any thoughts? |
Would you like to wrap any pointer data members with the template class "std::unique_ptr"?
Update candidates:
The text was updated successfully, but these errors were encountered: