Skip to content

Commit

Permalink
Avoid explicit boost::shared_ptr by using reset(), ctors, and auto
Browse files Browse the repository at this point in the history
  • Loading branch information
taketwo committed Mar 16, 2019
1 parent b3a5798 commit 36f7b0e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
Expand Up @@ -52,8 +52,7 @@ main (int argc, char** argv)
ism.setTrainingClasses (training_classes);
ism.setSamplingSize (2.0f);

pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal>::ISMModelPtr model = boost::shared_ptr<pcl::features::ISMModel>
(new pcl::features::ISMModel);
pcl::ism::ImplicitShapeModelEstimation<153, pcl::PointXYZ, pcl::Normal>::ISMModelPtr model (new pcl::features::ISMModel);
ism.trainISM (model);

std::string file ("trained_ism_model.txt");
Expand Down
Expand Up @@ -228,7 +228,7 @@ pcl::features::ISMVoteList<PointT>::validateTree ()
if (!tree_is_valid_)
{
if (tree_ == 0)
tree_ = boost::shared_ptr<pcl::KdTreeFLANN<pcl::InterestPoint> > (new pcl::KdTreeFLANN<pcl::InterestPoint> ());
tree_.reset (new pcl::KdTreeFLANN<pcl::InterestPoint>);
tree_->setInputCloud (votes_);
k_ind_.resize ( votes_->points.size (), -1 );
k_sqr_dist_.resize ( votes_->points.size (), 0.0f );
Expand Down Expand Up @@ -1238,7 +1238,7 @@ pcl::ism::ImplicitShapeModelEstimation<FeatureSize, PointT, NormalT>::estimateFe
typename pcl::PointCloud<NormalT>::Ptr normal_cloud,
typename pcl::PointCloud<pcl::Histogram<FeatureSize> >::Ptr feature_cloud)
{
typename pcl::search::Search<PointT>::Ptr tree = boost::shared_ptr<pcl::search::Search<PointT> > (new pcl::search::KdTree<PointT>);
typename pcl::search::Search<PointT>::Ptr tree (new pcl::search::KdTree<PointT>);
// tree->setInputCloud (point_cloud);

feature_estimator_->setInputCloud (sampled_point_cloud->makeShared ());
Expand Down
5 changes: 1 addition & 4 deletions recognition/src/face_detection/rf_face_detector_trainer.cpp
Expand Up @@ -58,10 +58,7 @@ void pcl::RFFaceDetectorTrainer::trainWithDataProvider()

dtdp->initialize (directory_);

boost::shared_ptr < pcl::DecisionTreeTrainerDataProvider<face_detection::FeatureType, std::vector<face_detection::TrainingExample>, float, int, NodeType>
> cast_dtdp;
cast_dtdp = boost::dynamic_pointer_cast
< pcl::DecisionTreeTrainerDataProvider<face_detection::FeatureType, std::vector<face_detection::TrainingExample>, float, int, NodeType> > (dtdp);
auto cast_dtdp = boost::dynamic_pointer_cast<pcl::DecisionTreeTrainerDataProvider<face_detection::FeatureType, std::vector<face_detection::TrainingExample>, float, int, NodeType>> (dtdp);
dft.setDecisionTreeDataProvider (cast_dtdp);

pcl::DecisionForest<NodeType> forest;
Expand Down
Expand Up @@ -25,7 +25,7 @@ pcl::tracking::KLDAdaptiveParticleFilterTracker<PointInT, StateT>::initCompute (
coherence_->setTargetCloud (input_);

if (!change_detector_)
change_detector_ = boost::shared_ptr<pcl::octree::OctreePointCloudChangeDetector<PointInT> >(new pcl::octree::OctreePointCloudChangeDetector<PointInT> (change_detector_resolution_));
change_detector_.reset (new pcl::octree::OctreePointCloudChangeDetector<PointInT> (change_detector_resolution_));

if (!particles_ || particles_->points.empty ())
initParticles (true);
Expand Down
2 changes: 1 addition & 1 deletion tracking/include/pcl/tracking/impl/particle_filter.hpp
Expand Up @@ -29,7 +29,7 @@ pcl::tracking::ParticleFilterTracker<PointInT, StateT>::initCompute ()
coherence_->setTargetCloud (input_);

if (!change_detector_)
change_detector_ = boost::shared_ptr<pcl::octree::OctreePointCloudChangeDetector<PointInT> >(new pcl::octree::OctreePointCloudChangeDetector<PointInT> (change_detector_resolution_));
change_detector_.reset (new pcl::octree::OctreePointCloudChangeDetector<PointInT> (change_detector_resolution_));

if (!particles_ || particles_->points.empty ())
initParticles (true);
Expand Down

0 comments on commit 36f7b0e

Please sign in to comment.