Skip to content

Commit 57926b8

Browse files
[filters/keypoints/octree/people/seg/surf] Migrate boost::function to std::function
1 parent e168f27 commit 57926b8

File tree

10 files changed

+17
-21
lines changed

10 files changed

+17
-21
lines changed

filters/include/pcl/filters/boost.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,4 @@
5353
#include <boost/mpl/size.hpp>
5454
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
5555
#include <boost/bind.hpp>
56-
#include <boost/function.hpp>
5756
#include <boost/optional.hpp>

filters/include/pcl/filters/model_outlier_removal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ namespace pcl
173173
* \param[in] thresh pointer to a threshold function
174174
*/
175175
void
176-
setThresholdFunction (boost::function<bool (double)> thresh)
176+
setThresholdFunction (std::function<bool (double)> thresh)
177177
{
178178
threshold_function_ = thresh;
179179
}
@@ -235,7 +235,7 @@ namespace pcl
235235

236236
/** \brief The type of model to use (user given parameter). */
237237
pcl::SacModel model_type_;
238-
boost::function<bool (double)> threshold_function_;
238+
std::function<bool (double)> threshold_function_;
239239

240240
inline bool
241241
checkSingleThreshold (double value)

keypoints/include/pcl/keypoints/keypoint.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939

4040
// PCL includes
4141
#include <pcl/pcl_base.h>
42-
#include <boost/function.hpp>
4342
#include <boost/bind.hpp>
4443
#include <pcl/search/pcl_search.h>
4544
#include <pcl/pcl_config.h>
45+
#include <functional>
4646

4747
namespace pcl
4848
{
@@ -67,8 +67,8 @@ namespace pcl
6767
typedef typename PointCloudIn::Ptr PointCloudInPtr;
6868
typedef typename PointCloudIn::ConstPtr PointCloudInConstPtr;
6969
typedef pcl::PointCloud<PointOutT> PointCloudOut;
70-
typedef boost::function<int (int, double, std::vector<int> &, std::vector<float> &)> SearchMethod;
71-
typedef boost::function<int (const PointCloudIn &cloud, int index, double, std::vector<int> &, std::vector<float> &)> SearchMethodSurface;
70+
typedef std::function<int (int, double, std::vector<int> &, std::vector<float> &)> SearchMethod;
71+
typedef std::function<int (const PointCloudIn &cloud, int index, double, std::vector<int> &, std::vector<float> &)> SearchMethodSurface;
7272

7373
public:
7474
/** \brief Empty constructor. */

octree/include/pcl/octree/boost.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@
4545

4646
// Marking all Boost headers as system headers to remove warnings
4747
#include <boost/graph/adjacency_list.hpp>
48-
#include <boost/function.hpp>

octree/include/pcl/octree/octree_pointcloud_adjacency.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ namespace pcl
154154
* \param[in] transform_func A boost:function pointer to the transform to be used. The transform must have one
155155
* parameter (a point) which it modifies in place. */
156156
void
157-
setTransformFunction (boost::function<void (PointT &p)> transform_func)
157+
setTransformFunction (std::function<void (PointT &p)> transform_func)
158158
{
159159
transform_func_ = transform_func;
160160
}
@@ -216,7 +216,7 @@ namespace pcl
216216
/// Local leaf pointer vector used to make iterating through leaves fast.
217217
LeafVectorT leaf_vector_;
218218

219-
boost::function<void (PointT &p)> transform_func_;
219+
std::function<void (PointT &p)> transform_func_;
220220

221221
};
222222

people/apps/main_ground_based_people_detection.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ int main (int argc, char** argv)
143143
PointCloudT::Ptr cloud (new PointCloudT);
144144
bool new_cloud_available_flag = false;
145145
pcl::Grabber* interface = new pcl::OpenNIGrabber();
146-
boost::function<void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&)> f =
146+
std::function<void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&)> f =
147147
boost::bind (&cloud_cb_, _1, cloud, &new_cloud_available_flag);
148148
interface->registerCallback (f);
149149
interface->start ();

segmentation/include/pcl/segmentation/conditional_euclidean_clustering.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737

3838
#pragma once
3939

40-
#include <boost/function.hpp>
41-
4240
#include <pcl/pcl_base.h>
4341
#include <pcl/search/pcl_search.h>
4442

43+
#include <functional>
44+
4545
namespace pcl
4646
{
4747
typedef std::vector<pcl::PointIndices> IndicesClusters;
@@ -148,7 +148,7 @@ namespace pcl
148148
/** \brief Set the condition that needs to hold for neighboring points to be considered part of the same cluster.
149149
* This is an overloaded function provided for convenience. See the documentation for setConditionFunction(). */
150150
inline void
151-
setConditionFunction (boost::function<bool (const PointT&, const PointT&, float)> condition_function)
151+
setConditionFunction (std::function<bool (const PointT&, const PointT&, float)> condition_function)
152152
{
153153
condition_function_ = condition_function;
154154
}
@@ -237,7 +237,7 @@ namespace pcl
237237
SearcherPtr searcher_;
238238

239239
/** \brief The condition function that needs to hold for clustering */
240-
boost::function<bool (const PointT&, const PointT&, float)> condition_function_;
240+
std::function<bool (const PointT&, const PointT&, float)> condition_function_;
241241

242242
/** \brief The distance to scan for cluster candidates (default = 0.0) */
243243
float cluster_tolerance_;

surface/include/pcl/surface/boost.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,5 @@
4444
#endif
4545

4646
#include <boost/bind.hpp>
47-
#include <boost/function.hpp>
4847
#include <boost/dynamic_bitset/dynamic_bitset.hpp>
4948
#include <boost/shared_ptr.hpp>

surface/include/pcl/surface/impl/mls.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ pcl::MLSResult::computeMLSSurface (const pcl::PointCloud<PointT> &cloud,
719719
const std::vector<int> &nn_indices,
720720
double search_radius,
721721
int polynomial_order,
722-
boost::function<double(const double)> weight_func)
722+
std::function<double(const double)> weight_func)
723723
{
724724
// Compute the plane coefficients
725725
EIGEN_ALIGN16 Eigen::Matrix3d covariance_matrix;
@@ -777,7 +777,7 @@ pcl::MLSResult::computeMLSSurface (const pcl::PointCloud<PointT> &cloud,
777777
{
778778
// Note: The max_sq_radius parameter is only used if weight_func was not defined
779779
double max_sq_radius = 1;
780-
if (weight_func.empty())
780+
if (!weight_func)
781781
{
782782
max_sq_radius = search_radius * search_radius;
783783
weight_func = boost::bind (&pcl::MLSResult::computeMLSWeight, this, _1, max_sq_radius);

surface/include/pcl/surface/mls.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@
3939

4040
#pragma once
4141

42+
#include <functional>
4243
#include <map>
4344
#include <random>
4445

45-
#include <boost/function.hpp>
46-
4746
// PCL includes
4847
#include <pcl/pcl_base.h>
4948
#include <pcl/search/pcl_search.h>
@@ -210,7 +209,7 @@ namespace pcl
210209
const std::vector<int> &nn_indices,
211210
double search_radius,
212211
int polynomial_order = 2,
213-
boost::function<double(const double)> weight_func = {});
212+
std::function<double(const double)> weight_func = {});
214213

215214
Eigen::Vector3d query_point; /**< \brief The query point about which the mls surface was generated */
216215
Eigen::Vector3d mean; /**< \brief The mean point of all the neighbors. */
@@ -274,7 +273,7 @@ namespace pcl
274273
typedef typename PointCloudIn::Ptr PointCloudInPtr;
275274
typedef typename PointCloudIn::ConstPtr PointCloudInConstPtr;
276275

277-
typedef boost::function<int (int, double, std::vector<int> &, std::vector<float> &)> SearchMethod;
276+
typedef std::function<int (int, double, std::vector<int> &, std::vector<float> &)> SearchMethod;
278277

279278
enum UpsamplingMethod
280279
{

0 commit comments

Comments
 (0)