Skip to content

Commit

Permalink
Satisfy clang-tidy's modernize-use-auto
Browse files Browse the repository at this point in the history
  • Loading branch information
mvieth committed Dec 15, 2024
1 parent 2d4a3fe commit 7d54259
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions geometry/include/pcl/geometry/mesh_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -1804,14 +1804,14 @@ class MeshBase {
typename IndexContainerT::value_type());
Index ind_old(0), ind_new(0);

typename ElementContainerT::const_iterator it_e_old = elements.begin();
auto it_e_old = elements.cbegin();
auto it_e_new = elements.begin();

typename DataContainerT::const_iterator it_d_old = data_cloud.begin();
auto it_d_old = data_cloud.cbegin();
auto it_d_new = data_cloud.begin();

auto it_ind_new = new_indices.begin();
typename IndexContainerT::const_iterator it_ind_new_end = new_indices.end();
auto it_ind_new_end = new_indices.cend();

while (it_ind_new != it_ind_new_end) {
if (!this->isDeleted(ind_old)) {
Expand Down
12 changes: 6 additions & 6 deletions io/src/openni2/openni2_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ pcl::io::openni2::OpenNI2Device::isIRVideoModeSupported (const OpenNI2VideoMode&

bool supported = false;

std::vector<OpenNI2VideoMode>::const_iterator it = ir_video_modes_.begin ();
std::vector<OpenNI2VideoMode>::const_iterator it_end = ir_video_modes_.end ();
auto it = ir_video_modes_.cbegin ();
auto it_end = ir_video_modes_.cend ();

while (it != it_end && !supported)
{
Expand All @@ -234,8 +234,8 @@ pcl::io::openni2::OpenNI2Device::isColorVideoModeSupported (const OpenNI2VideoMo

bool supported = false;

std::vector<OpenNI2VideoMode>::const_iterator it = color_video_modes_.begin ();
std::vector<OpenNI2VideoMode>::const_iterator it_end = color_video_modes_.end ();
auto it = color_video_modes_.cbegin ();
auto it_end = color_video_modes_.cend ();

while (it != it_end && !supported)
{
Expand All @@ -253,8 +253,8 @@ pcl::io::openni2::OpenNI2Device::isDepthVideoModeSupported (const OpenNI2VideoMo

bool supported = false;

std::vector<OpenNI2VideoMode>::const_iterator it = depth_video_modes_.begin ();
std::vector<OpenNI2VideoMode>::const_iterator it_end = depth_video_modes_.end ();
auto it = depth_video_modes_.cbegin ();
auto it_end = depth_video_modes_.cend ();

while (it != it_end && !supported)
{
Expand Down
4 changes: 2 additions & 2 deletions io/src/openni2/openni2_timer_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ namespace pcl
{
double sum = 0;

std::deque<double>::const_iterator it = buffer_.begin ();
std::deque<double>::const_iterator it_end = buffer_.end ();
auto it = buffer_.cbegin ();
auto it_end = buffer_.cend ();

while (it != it_end)
{
Expand Down
2 changes: 1 addition & 1 deletion io/src/openni_camera/openni_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ openni_wrapper::OpenNIDriver::getDeviceInfos () noexcept
{
libusb_device* device = devices[devIdx];
std::uint8_t busId = libusb_get_bus_number (device);
std::map<unsigned char, std::map<unsigned char, unsigned> >::const_iterator busIt = bus_map_.find (busId);
auto busIt = bus_map_.find (busId);
if (busIt == bus_map_.end ())
continue;

Expand Down
8 changes: 4 additions & 4 deletions octree/include/pcl/octree/impl/octree2buf_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::deserializeTree(
leaf_count_ = 0;

// iterator for binary tree structure vector
std::vector<char>::const_iterator binary_tree_in_it = binary_tree_in_arg.begin();
std::vector<char>::const_iterator binary_tree_in_it_end = binary_tree_in_arg.end();
auto binary_tree_in_it = binary_tree_in_arg.cbegin();
auto binary_tree_in_it_end = binary_tree_in_arg.cend();

deserializeTreeRecursive(root_node_,
depth_mask_,
Expand Down Expand Up @@ -318,8 +318,8 @@ Octree2BufBase<LeafContainerT, BranchContainerT>::deserializeTree(
leaf_count_ = 0;

// iterator for binary tree structure vector
std::vector<char>::const_iterator binary_tree_in_it = binary_tree_in_arg.begin();
std::vector<char>::const_iterator binary_tree_in_it_end = binary_tree_in_arg.end();
auto binary_tree_in_it = binary_tree_in_arg.cbegin();
auto binary_tree_in_it_end = binary_tree_in_arg.cend();

deserializeTreeRecursive(root_node_,
depth_mask_,
Expand Down
8 changes: 4 additions & 4 deletions octree/include/pcl/octree/impl/octree_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ OctreeBase<LeafContainerT, BranchContainerT>::deserializeTree(
deleteTree();

// iterator for binary tree structure vector
std::vector<char>::const_iterator binary_tree_out_it = binary_tree_out_arg.begin();
std::vector<char>::const_iterator binary_tree_out_it_end = binary_tree_out_arg.end();
auto binary_tree_out_it = binary_tree_out_arg.cbegin();
auto binary_tree_out_it_end = binary_tree_out_arg.cend();

deserializeTreeRecursive(root_node_,
depth_mask_,
Expand Down Expand Up @@ -277,8 +277,8 @@ OctreeBase<LeafContainerT, BranchContainerT>::deserializeTree(
deleteTree();

// iterator for binary tree structure vector
std::vector<char>::const_iterator binary_tree_input_it = binary_tree_in_arg.begin();
std::vector<char>::const_iterator binary_tree_input_it_end = binary_tree_in_arg.end();
auto binary_tree_input_it = binary_tree_in_arg.cbegin();
auto binary_tree_input_it_end = binary_tree_in_arg.cend();

deserializeTreeRecursive(root_node_,
depth_mask_,
Expand Down
2 changes: 1 addition & 1 deletion recognition/src/ransac_based/obj_rec_ransac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ pcl::recognition::ObjRecRANSAC::buildGraphOfCloseHypotheses (HypothesisOctree& h
i = 0;

// Now create the graph connectivity such that each two neighboring rotation spaces are neighbors in the graph
for ( std::vector<HypothesisOctree::Node*>::const_iterator hypo = hypo_leaves.begin () ; hypo != hypo_leaves.end () ; ++hypo, ++i )
for ( auto hypo = hypo_leaves.cbegin () ; hypo != hypo_leaves.cend () ; ++hypo, ++i )
{
// Compute the fitness of the graph node
graph.getNodes ()[i]->setFitness (static_cast<int> ((*hypo)->getData ().explained_pixels_.size ()));
Expand Down
6 changes: 3 additions & 3 deletions surface/include/pcl/surface/impl/marching_cubes_rbf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ pcl::MarchingCubesRBF<PointNT>::voxelizeData ()
const Eigen::Vector3d point = point_f.cast<double> ();

double f = 0.0;
std::vector<double>::const_iterator w_it (weights.begin());
for (std::vector<Eigen::Vector3d, Eigen::aligned_allocator<Eigen::Vector3d> >::const_iterator c_it = centers.begin ();
c_it != centers.end (); ++c_it, ++w_it)
auto w_it (weights.cbegin());
for (auto c_it = centers.cbegin ();
c_it != centers.cend (); ++c_it, ++w_it)
f += *w_it * kernel (*c_it, point);

grid_[x * res_y_*res_z_ + y * res_z_ + z] = static_cast<float>(f);
Expand Down
2 changes: 1 addition & 1 deletion visualization/src/pcl_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ void
pcl::visualization::PCLVisualizer::resetCameraViewpoint (const std::string &id)
{
vtkSmartPointer<vtkMatrix4x4> camera_pose;
const CloudActorMap::iterator it = cloud_actor_map_->find(id);
const auto it = cloud_actor_map_->find(id);
if (it != cloud_actor_map_->end ())
camera_pose = it->second.viewpoint_transformation_;
else
Expand Down

0 comments on commit 7d54259

Please sign in to comment.