-
-
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
From new
to pcl::make_shared
using clang-tidy
#3206
Changes from all commits
8913082
1e4f25a
a2000ed
62337b2
53733f6
cb27660
6a8ef83
3946e1f
5d3da10
baa4275
a9afd0b
502fe5f
5b7153e
65ea25a
bd7e25e
c559213
f0a1cd7
e949c49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ | |
#include <pcl/features/shot_omp.h> | ||
#include <pcl/io/pcd_io.h> | ||
|
||
#include <pcl/make_shared.h> | ||
|
||
namespace pcl | ||
{ | ||
namespace rec_3d_framework | ||
|
@@ -63,7 +65,7 @@ namespace pcl | |
mls.setUpsamplingStepSize (0.001); | ||
} | ||
|
||
normals.reset (new pcl::PointCloud<pcl::Normal>); | ||
normals = pcl::make_shared<pcl::PointCloud<pcl::Normal>> (); | ||
{ | ||
pcl::ScopeTime t ("Compute normals"); | ||
normal_estimator_->estimate (in, processed, normals); | ||
|
@@ -77,7 +79,7 @@ namespace pcl | |
mls.process (*filtered); | ||
|
||
processed.reset (new pcl::PointCloud<PointInT>); | ||
normals.reset (new pcl::PointCloud<pcl::Normal>); | ||
normals = pcl::make_shared<pcl::PointCloud<pcl::Normal>> (); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as before. |
||
{ | ||
pcl::ScopeTime t ("Compute normals after MLS"); | ||
filtered->is_dense = false; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
|
||
#include <random> | ||
|
||
#include <pcl/make_shared.h> | ||
|
||
#include <pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_crh.h> | ||
#include <pcl/recognition/crh_alignment.h> | ||
#include <pcl/registration/icp.h> | ||
|
@@ -47,7 +49,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT> | |
CRHPointCloud::Ptr & hist) | ||
{ | ||
|
||
hist.reset (new CRHPointCloud); | ||
hist = pcl::make_shared<CRHPointCloud> (); | ||
std::stringstream dir; | ||
std::string path = source_->getModelDescriptorDir (model, training_dir_, descr_name_); | ||
dir << path << "/crh_" << view_id << "_" << d_id << ".pcd"; | ||
|
@@ -377,7 +379,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT> | |
boost::shared_ptr < std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > > transforms_temp; | ||
|
||
models_temp.reset (new std::vector<ModelT>); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use std::make_shared here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is replacement of every |
||
transforms_temp.reset (new std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> >); | ||
transforms_temp = pcl::make_shared<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> >> (); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. However, you can't use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case the custom allocator is for contained objects, not the vector itself. Therefore, default allocator is suitable for the vector. However, I'd invoke the same comment as above here, in my opinion no need to replace |
||
|
||
for (size_t i = 0; i < models_->size (); i++) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,11 @@ | |
*/ | ||
|
||
#include <flann/flann.hpp> | ||
|
||
#include <pcl/make_shared.h> | ||
#include <pcl/apps/3d_rec_framework/pipeline/global_nn_recognizer_cvfh.h> | ||
#include <pcl/registration/icp.h> | ||
#include <pcl/common/time.h> | ||
#include <pcl/registration/icp.h> | ||
#include <pcl/visualization/pcl_visualizer.h> | ||
|
||
template<template<class > class Distance, typename PointInT, typename FeatureT> | ||
|
@@ -598,7 +600,7 @@ template<template<class > class Distance, typename PointInT, typename FeatureT> | |
boost::shared_ptr < std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > > transforms_temp; | ||
|
||
models_temp.reset (new std::vector<ModelT>); | ||
transforms_temp.reset (new std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> >); | ||
transforms_temp = pcl::make_shared<std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> >> (); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment here for line 602 and 603. |
||
|
||
for (size_t i = 0; i < models_->size (); 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.
The line above this one should also be replaced no?
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.
PointInT
is a template parameter, I didn't test for that and apparently the check is failing with those. As is, I also have a failing test for when there istypedef boost::shared_ptr<Derived> Ptr;