Skip to content

Commit 55489e2

Browse files
committed
Define pcl::experimental::optional
1 parent 9999778 commit 55489e2

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

filters/include/pcl/filters/experimental/transform_filter.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212
#include <pcl/common/point_tests.h>
1313
#include <pcl/filters/filter.h>
1414

15+
#include <boost/optional.hpp> // std::optional for C++17
16+
1517
namespace pcl {
1618
namespace experimental {
1719

20+
template <typename PointT>
21+
using optional = boost::optional<PointT>;
22+
1823
#define GET_POINT_TYPE(GridStructT) typename GridStructT::PointCloud::PointType
1924

2025
/**
@@ -78,10 +83,9 @@ class TransformFilter : public Filter<PointT>, public GridStruct {
7883
// allocate enough space for points
7984
output.reserve(GridStruct::grid_.size());
8085
for (auto it = GridStruct::grid_.begin(); it != GridStruct::grid_.end(); ++it) {
81-
const auto& res = GridStruct::filterGrid(it);
82-
if (res) {
86+
const experimental::optional<PointT> res = GridStruct::filterGrid(it);
87+
if (res)
8388
output.push_back(res.value());
84-
}
8589
}
8690
}
8791
};

filters/include/pcl/filters/experimental/voxel_grid.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include <pcl/common/common.h>
1414
#include <pcl/filters/experimental/grid_filter_base.h>
1515

16-
#include <boost/optional.hpp> // std::optional for C++17
17-
1816
#include <unordered_map>
1917

2018
namespace pcl {
@@ -345,7 +343,7 @@ class VoxelStructT {
345343
grid_[h].add(pt);
346344
}
347345

348-
inline boost::optional<PointT>
346+
inline experimental::optional<PointT>
349347
filterGrid(const GridIterator grid_it)
350348
{
351349
const auto& voxel = grid_it->second;

0 commit comments

Comments
 (0)