Provide dynamic and static pointer casts in pcl namespace to allow easy migration from boost to std smart pointers#3770
Merged
SergioRAgostinho merged 8 commits intoPointCloudLibrary:masterfrom Apr 16, 2020
Conversation
kunaltyagi
reviewed
Mar 22, 2020
Member
|
Based on the CI, I'd say that we need |
Contributor
|
If I'm not mistaken ADL does not work here because smart pointer casts are function templates taking an explicit template parameter - this was fixed in C++20 but you have to workaround it in earlier standard versions. You can work around it by first making one of the names visible to the compiler in scope, then ADL should work properly: boost::shared<U> ptr;
using std::dynamic_pointer_cast; // The compiler sees a function template and considers that unqualified `dynamic_pointer_cast` has to be resolved as a function name/overload set
auto ptr2 = dynamic_pointer_cast<T>(ptr); // ADL is performed, boost::dynamic_pointer_cast is found despite std:: being used to make the name visibleSprinkling |
kunaltyagi
reviewed
Mar 23, 2020
Member
|
Just waiting for another set of eyes before merge. |
SergioRAgostinho
approved these changes
Apr 16, 2020
pcl namespace to allow easy migration
pcl namespace to allow easy migrationpcl namespace to allow easy migration from boost to std smart pointers
truhoang
pushed a commit
to truhoang/pcl
that referenced
this pull request
Jun 30, 2020
…sy migration in future (PointCloudLibrary#3770) * unqualify boost::dynamic_pointer_cast for switch to std:: * unqualify boost::static_pointer_cast for switch to std:: * have consistent using declarations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stems from #3750.