Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use make function instead of smart pointer constructor. #162

Merged
merged 3 commits into from
Feb 6, 2017
Merged

Use make function instead of smart pointer constructor. #162

merged 3 commits into from
Feb 6, 2017

Conversation

amaggiulli
Copy link
Contributor

No description provided.

@@ -201,8 +201,8 @@ namespace QuantLib {

MakeCms& MakeCms::withDiscountingTermStructure(
const Handle<YieldTermStructure>& discountingTermStructure) {
engine_ = boost::shared_ptr<PricingEngine>(new
DiscountingSwapEngine(discountingTermStructure));
engine_ = boost::static_pointer_cast<PricingEngine>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the static_pointer_cast should not be necessary?

Copy link
Contributor Author

@amaggiulli amaggiulli Nov 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As engine_ is a boost::shared_ptr<PricingEngine> static_pointer_cast make explicit an implicit conversion with no run-time impact. I usually use the cast when I know the code must be compiled on different OS , because some compiler may complain about it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, is it just to be 110% safe or did you actually see a compiler having problems with it? It would be interesting to know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is to be 110% safe . I tested this on Windows VS and Centos 7 gcc 4.8.5 with no problem.
Can be removed .

@lballabio lballabio added this to the 1.10 release milestone Jan 10, 2017
@lballabio lballabio merged commit 5004bfe into lballabio:master Feb 6, 2017
lballabio added a commit that referenced this pull request Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants