Skip to content

Commit

Permalink
use emplace_back instead of push_back
Browse files Browse the repository at this point in the history
  • Loading branch information
DIlkhush00 committed Sep 8, 2024
1 parent 741bc81 commit 50ec9c5
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion io/include/pcl/io/grabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ namespace pcl
boost::signals2::connection ret = signal->connect (callback);

connections_[typeid (T).name ()].push_back (ret);
shared_connections_[typeid (T).name ()].push_back (boost::signals2::shared_connection_block (connections_[typeid (T).name ()].back (), false));
shared_connections_[typeid (T).name ()].emplace_back (connections_[typeid (T).name ()].back (), false);
signalsChanged ();
return (ret);
}
Expand Down
2 changes: 1 addition & 1 deletion keypoints/src/narf_keypoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ NarfKeypoint::calculateSparseInterestImage ()
static_cast<int> (pcl_lrint (std::floor ( (angle+deg2rad (90.0f))/deg2rad (180.0f) * angle_histogram_size))));
float& histogram_value = angle_histogram[histogram_cell];
histogram_value = (std::max) (histogram_value, surface_change_score);
angle_elements[histogram_cell].push_back (std::make_pair(index2, surface_change_score));
angle_elements[histogram_cell].emplace_back (index2, surface_change_score);
}

// Reset was_touched to false
Expand Down
2 changes: 1 addition & 1 deletion recognition/src/ransac_based/model_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ ModelLibrary::addToHashTable (Model* model, const ORROctree::Node::Data* data1,
HashTableCell* cell = hash_table_.getVoxel (key);

// Insert the pair (data1,data2) belonging to 'model'
(*cell)[model].push_back (std::pair<const ORROctree::Node::Data*, const ORROctree::Node::Data*> (data1, data2));
(*cell)[model].emplace_back (data1, data2);

return (true);
}
Expand Down
2 changes: 1 addition & 1 deletion test/outofcore/test_outofcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ TEST_F (OutofcoreTest, Outofcore_Constructors)
AlignedPointTVector some_points;

for (unsigned int i=0; i< numPts; i++)
some_points.push_back (PointT (static_cast<float>(rand () % 1024), static_cast<float>(rand () % 1024), static_cast<float>(rand () % 1024)));
some_points.emplace_back (static_cast<float>(rand () % 1024), static_cast<float>(rand () % 1024), static_cast<float>(rand () % 1024));


//(Case 1)
Expand Down
2 changes: 1 addition & 1 deletion tools/elch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ main (int argc, char **argv)
{
CloudPtr pc (new Cloud);
pcl::io::loadPCDFile (argv[pcd_indices[i]], *pc);
clouds.push_back (CloudPair (argv[pcd_indices[i]], pc));
clouds.emplace_back (argv[pcd_indices[i]], pc);
std::cout << "loading file: " << argv[pcd_indices[i]] << " size: " << pc->size () << std::endl;
elch.addPointCloud (clouds[i].second);
}
Expand Down
2 changes: 1 addition & 1 deletion tools/lum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ main (int argc, char **argv)
{
CloudPtr pc (new Cloud);
pcl::io::loadPCDFile (argv[pcd_indices[i]], *pc);
clouds.push_back (CloudPair (argv[pcd_indices[i]], pc));
clouds.emplace_back (argv[pcd_indices[i]], pc);
std::cout << "loading file: " << argv[pcd_indices[i]] << " size: " << pc->size () << std::endl;
lum.addPointCloud (clouds[i].second);
}
Expand Down

0 comments on commit 50ec9c5

Please sign in to comment.