Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Improve exception safety with smart pointers #311

Open
elfring opened this issue Nov 13, 2015 · 4 comments
Open

Improve exception safety with smart pointers #311

elfring opened this issue Nov 13, 2015 · 4 comments

Comments

@elfring
Copy link

elfring commented Nov 13, 2015

Would you like to wrap any pointer data members with the template class "std::unique_ptr"?

Update candidates:

@krocard
Copy link
Contributor

krocard commented Nov 15, 2015

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.

@divserge
Copy link

Hello everyone
Is this enchantment still viable? I'd be glad to resolve this one.

@dawagner
Copy link
Contributor

Hi, @divserge. Is it still relevant and you are welcome to tackle it; thanks!

@DanielLowry
Copy link

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?

vlmarkov added a commit to vlmarkov/parameter-framework that referenced this issue Jan 28, 2019
vlmarkov added a commit to vlmarkov/parameter-framework that referenced this issue Jan 28, 2019
vlmarkov added a commit to vlmarkov/parameter-framework that referenced this issue Jan 28, 2019
vlmarkov added a commit to vlmarkov/parameter-framework that referenced this issue Jan 28, 2019
vlmarkov added a commit to vlmarkov/parameter-framework that referenced this issue Jan 28, 2019
vlmarkov added a commit to vlmarkov/parameter-framework that referenced this issue Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants