-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Transition to standard smart pointers, part 4 #2929
Transition to standard smart pointers, part 4 #2929
Conversation
Modules: * kepoints * people * stereo * surface * tracking * tutorials
36f7b0e
to
dfa703a
Compare
This one is ready for review. |
@@ -141,12 +141,12 @@ template<typename ModelT, typename SceneT> | |||
typename boost::graph_traits<Graph>::adjacency_iterator ai; | |||
typename boost::graph_traits<Graph>::adjacency_iterator ai_end; | |||
|
|||
boost::shared_ptr < RecognitionModel > current = static_cast<boost::shared_ptr<RecognitionModel> > (graph_id_model_map_[int (v)]); | |||
auto current = boost::dynamic_pointer_cast<RecognitionModel> (graph_id_model_map_[int (v)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth to incur into the dynamic cast runtime penalty here? The subsequent logic is not handling null returns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I will replace this with boost::static_pointer_cast
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will squash this fix in corresponding commit right away.
|
||
bool a_better_one = false; | ||
for (boost::tie (ai, ai_end) = boost::adjacent_vertices (v, conflict_graph_); (ai != ai_end) && !a_better_one; ++ai) | ||
{ | ||
boost::shared_ptr < RecognitionModel > neighbour = static_cast<boost::shared_ptr<RecognitionModel> > (graph_id_model_map_[int (*ai)]); | ||
auto neighbour = boost::dynamic_pointer_cast<RecognitionModel> (graph_id_model_map_[int (*ai)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here.
@@ -169,7 +169,7 @@ template<typename ModelT, typename SceneT> | |||
for (size_t i = 0; i < (recognition_models_.size ()); i++) | |||
{ | |||
const typename Graph::vertex_descriptor v = boost::add_vertex (recognition_models_[i], conflict_graph_); | |||
graph_id_model_map_[int (v)] = static_cast<boost::shared_ptr<RecognitionModel> > (recognition_models_[i]); | |||
graph_id_model_map_[int (v)] = boost::dynamic_pointer_cast<RecognitionModel> (recognition_models_[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here.
dfa703a
to
b5df65f
Compare
For classes: * DecisionTreeTrainerDataProvider * DistanceCoherence * FaceDetectorDataProvider * ISMVoteList * IntegralImage2D * KLDAdaptiveParticleFilterOMPTracker * KLDAdaptiveParticleFilterTracker * OctreePointCloudChangeDetector * ParticleFilterTracker * RecognitionModel
Partially addresses #2792.