Permalink
Browse files

preincrement iterators to avoid the temporary

this suppress some cppcheck warnings
  • Loading branch information...
1 parent b61e088 commit a0a328412edc78998a9e78b60d248c46a550630e @soyersoyer soyersoyer committed Jan 20, 2015
@@ -480,7 +480,7 @@ pcl::modeler::SceneTree::dropEvent(QDropEvent * event)
std::set<RenderWindowItem*> previous_parents;
for (QList<CloudMeshItem*>::iterator selected_cloud_meshes_it = selected_cloud_meshes.begin();
selected_cloud_meshes_it != selected_cloud_meshes.end();
- selected_cloud_meshes_it ++)
+ ++ selected_cloud_meshes_it)
{
CloudMeshItem* cloud_mesh_item = *selected_cloud_meshes_it;
RenderWindowItem* render_window_item = dynamic_cast<RenderWindowItem*>(cloud_mesh_item->parent());
@@ -493,7 +493,7 @@ pcl::modeler::SceneTree::dropEvent(QDropEvent * event)
std::vector<CloudMeshItem*> cloud_mesh_items;
for (QList<CloudMeshItem*>::iterator selected_cloud_meshes_it = selected_cloud_meshes.begin();
selected_cloud_meshes_it != selected_cloud_meshes.end();
- selected_cloud_meshes_it ++)
+ ++ selected_cloud_meshes_it)
{
CloudMeshItem* cloud_mesh_item = *selected_cloud_meshes_it;
if (dynamic_cast<RenderWindowItem*>(cloud_mesh_item->parent()) == NULL)
@@ -515,7 +515,7 @@ pcl::modeler::SceneTree::dropEvent(QDropEvent * event)
for (std::set<RenderWindowItem*>::iterator previous_parents_it = previous_parents.begin();
previous_parents_it != previous_parents.end();
- previous_parents_it ++)
+ ++ previous_parents_it)
{
(*previous_parents_it)->getRenderWindow()->updateAxes();
(*previous_parents_it)->getRenderWindow()->render();
@@ -535,7 +535,7 @@ pcl::modeler::SceneTree::dropMimeData(QTreeWidgetItem * parent, int, const QMime
for (QList<CloudMeshItem*>::iterator selected_cloud_meshes_it = selected_cloud_meshes.begin();
selected_cloud_meshes_it != selected_cloud_meshes.end();
- selected_cloud_meshes_it ++)
+ ++ selected_cloud_meshes_it)
{
CloudMeshItem* cloud_mesh_item_copy = new CloudMeshItem(render_window_item, *(*selected_cloud_meshes_it));
render_window_item->addChild(cloud_mesh_item_copy);
@@ -89,7 +89,7 @@ class OpenNIChangeViewer
filtered_cloud.reset (new pcl::PointCloud<pcl::PointXYZRGBA> (*cloud));
filtered_cloud->points.reserve(newPointIdxVector->size());
- for (std::vector<int>::iterator it = newPointIdxVector->begin (); it != newPointIdxVector->end (); it++)
+ for (std::vector<int>::iterator it = newPointIdxVector->begin (); it != newPointIdxVector->end (); ++it)
filtered_cloud->points[*it].rgba = 255<<16;
if (!viewer.wasStopped())
@@ -101,7 +101,7 @@ class OpenNIChangeViewer
filtered_cloud->points.reserve(newPointIdxVector->size());
- for (std::vector<int>::iterator it = newPointIdxVector->begin (); it != newPointIdxVector->end (); it++)
+ for (std::vector<int>::iterator it = newPointIdxVector->begin (); it != newPointIdxVector->end (); ++it)
filtered_cloud->points.push_back(cloud->points[*it]);
@@ -85,7 +85,7 @@ main (int argc, char** argv)
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster (new pcl::PointCloud<pcl::PointXYZ>);
- for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); pit++)
+ for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit)
cloud_cluster->points.push_back (cloud_filtered->points[*pit]); //*
cloud_cluster->width = cloud_cluster->points.size ();
cloud_cluster->height = 1;
@@ -171,7 +171,7 @@ main (int argc, char *argv[])
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it, j++)
{
pcl::PointCloud<PointNormal>::Ptr cloud_cluster_don (new pcl::PointCloud<PointNormal>);
- for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); pit++)
+ for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit)
{
cloud_cluster_don->points.push_back (doncloud->points[*pit]);
}
@@ -215,7 +215,7 @@ int main (int argc, char *argv[])
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it, j++)
{
pcl::PointCloud<PointOutT>::Ptr cloud_cluster_don (new pcl::PointCloud<PointOutT>);
- for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); pit++){
+ for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit){
cloud_cluster_don->points.push_back (doncloud->points[*pit]);
}
@@ -95,7 +95,7 @@ main (int, char **argv)
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster (new pcl::PointCloud<pcl::PointXYZ>);
- for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); pit++)
+ for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit)
cloud_cluster->points.push_back (cloud_ptr->points[*pit]);
cloud_cluster->width = static_cast<uint32_t> (cloud_cluster->points.size ());
cloud_cluster->height = 1;
@@ -337,7 +337,7 @@ pcl::VoxelGridLabel::applyFilter (PointCloud &output)
int label = it->first;
if (it != labels.end ())
{
- for (it = labels.begin (); it != labels.end (); it++)
+ for (it = labels.begin (); it != labels.end (); ++it)
{
if (n_occurrence < it->second)
{
@@ -52,7 +52,7 @@ main (int argc, char** argv)
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster (new pcl::PointCloud<pcl::PointXYZ>);
- for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); pit++)
+ for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit)
cloud_cluster->points.push_back (cloud_filtered->points[*pit]); //*
cloud_cluster->width = cloud_cluster->points.size ();
cloud_cluster->height = 1;
@@ -97,7 +97,7 @@ main (int argc, char** argv)
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices_gpu.begin (); it != cluster_indices_gpu.end (); ++it)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_cluster_gpu (new pcl::PointCloud<pcl::PointXYZ>);
- for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); pit++)
+ for (std::vector<int>::const_iterator pit = it->indices.begin (); pit != it->indices.end (); ++pit)
cloud_cluster_gpu->points.push_back (cloud_filtered->points[*pit]); //*
cloud_cluster_gpu->width = cloud_cluster_gpu->points.size ();
cloud_cluster_gpu->height = 1;
@@ -536,7 +536,7 @@ pcl::io::openni2::OpenNI2Device::getDefaultIRMode () const
{
// Search for and return VGA@30 Hz mode
vector<OpenNI2VideoMode> modeList = getSupportedIRVideoModes ();
- for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); modeItr++)
+ for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); ++modeItr)
{
OpenNI2VideoMode mode = *modeItr;
if ( (mode.x_resolution_ == 640) && (mode.y_resolution_ == 480) && (mode.frame_rate_ == 30.0) )
@@ -550,7 +550,7 @@ pcl::io::openni2::OpenNI2Device::getDefaultColorMode () const
{
// Search for and return VGA@30 Hz mode
vector<OpenNI2VideoMode> modeList = getSupportedColorVideoModes ();
- for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); modeItr++)
+ for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); ++modeItr)
{
OpenNI2VideoMode mode = *modeItr;
if ( (mode.x_resolution_ == 640) && (mode.y_resolution_ == 480) && (mode.frame_rate_ == 30.0) )
@@ -564,7 +564,7 @@ pcl::io::openni2::OpenNI2Device::getDefaultDepthMode () const
{
// Search for and return VGA@30 Hz mode
vector<OpenNI2VideoMode> modeList = getSupportedDepthVideoModes ();
- for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); modeItr++)
+ for (vector<OpenNI2VideoMode>::iterator modeItr = modeList.begin (); modeItr != modeList.end (); ++modeItr)
{
OpenNI2VideoMode mode = *modeItr;
if ( (mode.x_resolution_ == 640) && (mode.y_resolution_ == 480) && (mode.frame_rate_ == 30.0) )
@@ -421,8 +421,8 @@ openni_wrapper::OpenNIDriver::getSerialNumber (unsigned index) const throw ()
boost::char_separator<char> sep ("#");
boost::tokenizer<boost::char_separator<char> > tokens (info, sep);
boost::tokenizer<boost::char_separator<char> >::iterator itr = tokens.begin ();
- itr++;
- itr++;
+ ++itr;
+ ++itr;
std::string sn = *itr;
device_context_[index].device_node.SetInstanceName(sn.c_str ());
return (device_context_[index].device_node.GetInstanceName ());
@@ -224,7 +224,7 @@ pcl::keypoints::agast::AbstractAgastDetector::applyNonMaxSuppression (
}
}
- curr_corner++;
+ ++curr_corner;
}
// collecting maximum corners
@@ -170,12 +170,12 @@ pcl::Permutohedral::init (const std::vector<float> &feature, const int feature_d
// check if key is the right one
int tmp_key_index = -1;
//for (int ii = key_index; ii < keys.size (); ii++)
- for (it = hash_table.find (hash_key); it != hash_table.end (); it++)
+ for (it = hash_table.find (hash_key); it != hash_table.end (); ++it)
{
int ii = it->second;
bool same = true;
std::vector<short> k = keys[ii];
- for (int i_k = 0; i_k < static_cast<int> (k.size ()); i_k++)
+ for (size_t i_k = 0; i_k < k.size (); i_k++)
{
if (key[i_k] != k[i_k])
{
@@ -110,7 +110,7 @@ Object::removeActor (vtkActor *actor)
{
std::set<vtkRenderer*>::iterator renderer_it;
for (renderer_it = associated_renderers_[actor].begin (); renderer_it != associated_renderers_[actor].end ();
- renderer_it++)
+ ++renderer_it)
{
(*renderer_it)->RemoveActor (actor);
}
@@ -96,7 +96,7 @@ pcl::segmentation::grabcut::BoykovKolmogorov::preAugmentPaths ()
if (source_edges_[u] == 0.0) continue;
// augment s-u-v-t paths
- for (std::map<int, double>::iterator it = nodes_[u].begin (); it != nodes_[u].end (); it++)
+ for (std::map<int, double>::iterator it = nodes_[u].begin (); it != nodes_[u].end (); ++it)
{
const int v = it->first;
if ((it->second == 0.0) || (target_edges_[v] == 0.0)) continue;
@@ -227,7 +227,7 @@ pcl::segmentation::grabcut::BoykovKolmogorov::reset ()
std::fill (target_edges_.begin (), target_edges_.end (), 0.0);
for (int u = 0; u < (int)nodes_.size (); u++)
{
- for (capacitated_edge::iterator it = nodes_[u].begin (); it != nodes_[u].end (); it++)
+ for (capacitated_edge::iterator it = nodes_[u].begin (); it != nodes_[u].end (); ++it)
{
it->second = 0.0;
}
@@ -311,7 +311,7 @@ pcl::segmentation::grabcut::BoykovKolmogorov::expandTrees ()
const int u = active_head_;
if (cut_[u] == SOURCE) {
- for (capacitated_edge::iterator it = nodes_[u].begin (); it != nodes_[u].end (); it++)
+ for (capacitated_edge::iterator it = nodes_[u].begin (); it != nodes_[u].end (); ++it)
{
if (it->second > 0.0)
{
@@ -334,7 +334,7 @@ pcl::segmentation::grabcut::BoykovKolmogorov::expandTrees ()
}
else
{
- for (capacitated_edge::iterator it = nodes_[u].begin (); it != nodes_[u].end (); it++)
+ for (capacitated_edge::iterator it = nodes_[u].begin (); it != nodes_[u].end (); ++it)
{
if (cut_[it->first] == TARGET) continue;
if (nodes_[it->first][u] > 0.0)
@@ -59,9 +59,9 @@ SparseMat::get (std::vector<int> &i, std::vector<int> &j, std::vector<double> &v
i.push_back (it_row->first);
j.push_back (it_col->first);
v.push_back (it_col->second);
- it_col++;
+ ++it_col;
}
- it_row++;
+ ++it_row;
}
}
@@ -148,7 +148,7 @@ SparseMat::deleteColumn (int j)
it_col = it_row->second.find (j);
if (it_col != it_row->second.end ())
it_row->second.erase (it_col);
- it_row++;
+ ++it_row;
}
}
@@ -173,15 +173,15 @@ SparseMat::size (int &si, int &sj)
while (it_row != m_mat.end ())
{
it_col = it_row->second.end ();
- it_col--;
+ --it_col;
if (sj < ((*it_col).first + 1))
sj = (*it_col).first + 1;
- it_row++;
+ ++it_row;
}
it_row = m_mat.end ();
- it_row--;
+ --it_row;
si = (*it_row).first + 1;
}
@@ -197,7 +197,7 @@ SparseMat::nonzeros ()
{
s += int (it_row->second.size ());
- it_row++;
+ ++it_row;
}
return s;
@@ -236,10 +236,10 @@ SparseMat::print ()
while (it_col != it_row->second.end ())
{
printf ("[%d,%d] %f ", it_row->first, it_col->first, it_col->second);
- it_col++;
+ ++it_col;
}
printf ("\n");
- it_row++;
+ ++it_row;
}
}

0 comments on commit a0a3284

Please sign in to comment.