From 7d54259df6264b67870411003b18aa1b8a585e9b Mon Sep 17 00:00:00 2001 From: Markus Vieth Date: Sun, 15 Dec 2024 17:15:23 +0100 Subject: [PATCH] Satisfy clang-tidy's modernize-use-auto --- geometry/include/pcl/geometry/mesh_base.h | 6 +++--- io/src/openni2/openni2_device.cpp | 12 ++++++------ io/src/openni2/openni2_timer_filter.cpp | 4 ++-- io/src/openni_camera/openni_driver.cpp | 2 +- octree/include/pcl/octree/impl/octree2buf_base.hpp | 8 ++++---- octree/include/pcl/octree/impl/octree_base.hpp | 8 ++++---- recognition/src/ransac_based/obj_rec_ransac.cpp | 2 +- .../include/pcl/surface/impl/marching_cubes_rbf.hpp | 6 +++--- visualization/src/pcl_visualizer.cpp | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/geometry/include/pcl/geometry/mesh_base.h b/geometry/include/pcl/geometry/mesh_base.h index 20003ce49d6..014b8c862eb 100644 --- a/geometry/include/pcl/geometry/mesh_base.h +++ b/geometry/include/pcl/geometry/mesh_base.h @@ -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)) { diff --git a/io/src/openni2/openni2_device.cpp b/io/src/openni2/openni2_device.cpp index b7201ac889c..a029e532aa4 100644 --- a/io/src/openni2/openni2_device.cpp +++ b/io/src/openni2/openni2_device.cpp @@ -215,8 +215,8 @@ pcl::io::openni2::OpenNI2Device::isIRVideoModeSupported (const OpenNI2VideoMode& bool supported = false; - std::vector::const_iterator it = ir_video_modes_.begin (); - std::vector::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) { @@ -234,8 +234,8 @@ pcl::io::openni2::OpenNI2Device::isColorVideoModeSupported (const OpenNI2VideoMo bool supported = false; - std::vector::const_iterator it = color_video_modes_.begin (); - std::vector::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) { @@ -253,8 +253,8 @@ pcl::io::openni2::OpenNI2Device::isDepthVideoModeSupported (const OpenNI2VideoMo bool supported = false; - std::vector::const_iterator it = depth_video_modes_.begin (); - std::vector::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) { diff --git a/io/src/openni2/openni2_timer_filter.cpp b/io/src/openni2/openni2_timer_filter.cpp index 932ff0a2a14..538c521196f 100644 --- a/io/src/openni2/openni2_timer_filter.cpp +++ b/io/src/openni2/openni2_timer_filter.cpp @@ -73,8 +73,8 @@ namespace pcl { double sum = 0; - std::deque::const_iterator it = buffer_.begin (); - std::deque::const_iterator it_end = buffer_.end (); + auto it = buffer_.cbegin (); + auto it_end = buffer_.cend (); while (it != it_end) { diff --git a/io/src/openni_camera/openni_driver.cpp b/io/src/openni_camera/openni_driver.cpp index 11e50769a2a..5b58936b127 100644 --- a/io/src/openni_camera/openni_driver.cpp +++ b/io/src/openni_camera/openni_driver.cpp @@ -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 >::const_iterator busIt = bus_map_.find (busId); + auto busIt = bus_map_.find (busId); if (busIt == bus_map_.end ()) continue; diff --git a/octree/include/pcl/octree/impl/octree2buf_base.hpp b/octree/include/pcl/octree/impl/octree2buf_base.hpp index b91b03baf01..790a6c15535 100644 --- a/octree/include/pcl/octree/impl/octree2buf_base.hpp +++ b/octree/include/pcl/octree/impl/octree2buf_base.hpp @@ -279,8 +279,8 @@ Octree2BufBase::deserializeTree( leaf_count_ = 0; // iterator for binary tree structure vector - std::vector::const_iterator binary_tree_in_it = binary_tree_in_arg.begin(); - std::vector::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_, @@ -318,8 +318,8 @@ Octree2BufBase::deserializeTree( leaf_count_ = 0; // iterator for binary tree structure vector - std::vector::const_iterator binary_tree_in_it = binary_tree_in_arg.begin(); - std::vector::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_, diff --git a/octree/include/pcl/octree/impl/octree_base.hpp b/octree/include/pcl/octree/impl/octree_base.hpp index 92b0489ef1e..6866f937b15 100644 --- a/octree/include/pcl/octree/impl/octree_base.hpp +++ b/octree/include/pcl/octree/impl/octree_base.hpp @@ -244,8 +244,8 @@ OctreeBase::deserializeTree( deleteTree(); // iterator for binary tree structure vector - std::vector::const_iterator binary_tree_out_it = binary_tree_out_arg.begin(); - std::vector::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_, @@ -277,8 +277,8 @@ OctreeBase::deserializeTree( deleteTree(); // iterator for binary tree structure vector - std::vector::const_iterator binary_tree_input_it = binary_tree_in_arg.begin(); - std::vector::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_, diff --git a/recognition/src/ransac_based/obj_rec_ransac.cpp b/recognition/src/ransac_based/obj_rec_ransac.cpp index a57b2d4bc6f..25aba5c0cb3 100644 --- a/recognition/src/ransac_based/obj_rec_ransac.cpp +++ b/recognition/src/ransac_based/obj_rec_ransac.cpp @@ -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::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 ((*hypo)->getData ().explained_pixels_.size ())); diff --git a/surface/include/pcl/surface/impl/marching_cubes_rbf.hpp b/surface/include/pcl/surface/impl/marching_cubes_rbf.hpp index 3c8529c978c..3e72a13aac4 100644 --- a/surface/include/pcl/surface/impl/marching_cubes_rbf.hpp +++ b/surface/include/pcl/surface/impl/marching_cubes_rbf.hpp @@ -94,9 +94,9 @@ pcl::MarchingCubesRBF::voxelizeData () const Eigen::Vector3d point = point_f.cast (); double f = 0.0; - std::vector::const_iterator w_it (weights.begin()); - for (std::vector >::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(f); diff --git a/visualization/src/pcl_visualizer.cpp b/visualization/src/pcl_visualizer.cpp index 902ee201657..c7f2b4b78a9 100644 --- a/visualization/src/pcl_visualizer.cpp +++ b/visualization/src/pcl_visualizer.cpp @@ -2179,7 +2179,7 @@ void pcl::visualization::PCLVisualizer::resetCameraViewpoint (const std::string &id) { vtkSmartPointer 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