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

--enable-thread-safe-observer-pattern doesn't work with --enable-std-pointers #546

Closed
lballabio opened this issue Sep 21, 2018 · 4 comments · Fixed by #549
Closed

--enable-thread-safe-observer-pattern doesn't work with --enable-std-pointers #546

lballabio opened this issue Sep 21, 2018 · 4 comments · Fixed by #549

Comments

@lballabio
Copy link
Owner

Passing both flags to configure result in a number of compilation errors, due primarily to the use of boost::enable_shared_from_this (which should be imported into the ext namespace in <ql/shared_ptr.hpp>) and secondarily by a few methods in the implementation whose call doesn't work.

@klausspanderen
Copy link
Contributor

Hi Luigi,

I think the thread safe observer pattern will only work with C++17. The implementation uses
boost::enable_shared_from_this::weak_from_this() aka
std::enable_shared_from_this::weak_from_this(),
which is only available in C++17 onward. Shall we add a check for both flags in the configure script / userconfig.hpp?

@lballabio
Copy link
Owner Author

There's also a call to _empty() that only works with Boost, and possibly something else that I don't remember.

I don't know about the check in configure. I'd try not to make it overly complex...

@klausspanderen
Copy link
Contributor

The C++17 port of the observer pattern can be found here
https://github.com/haozhangphd/QuantLib-noBoost
The call to _empty() is replaced by expired().

@lballabio
Copy link
Owner Author

Ok. Then I'd make sure it works, and then I would just document in configure --help that in order to use both switches C++17 is required.

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 a pull request may close this issue.

2 participants