Skip to content

Commit 5752b6e

Browse files
committed
Replace BOOST_MPL_ASSERT by static_assert
1 parent 58f9cfb commit 5752b6e

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

common/include/pcl/common/concatenate.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ namespace pcl
6363
using InT = typename pcl::traits::datatype<PointInT, Key>::type;
6464
using OutT = typename pcl::traits::datatype<PointOutT, Key>::type;
6565
// Note: don't currently support different types for the same field (e.g. converting double to float)
66-
BOOST_MPL_ASSERT_MSG ((std::is_same<InT, OutT>::value),
67-
POINT_IN_AND_POINT_OUT_HAVE_DIFFERENT_TYPES_FOR_FIELD,
68-
(Key, PointInT&, InT, PointOutT&, OutT));
66+
static_assert(std::is_same<InT, OutT>::value,
67+
"PointInT and PointOutT have different types for field.");
6968
memcpy (reinterpret_cast<std::uint8_t*>(&p2_) + pcl::traits::offset<PointOutT, Key>::value,
7069
reinterpret_cast<const std::uint8_t*>(&p1_) + pcl::traits::offset<PointInT, Key>::value,
7170
sizeof (InT));

common/include/pcl/for_each_type.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ namespace pcl
9090
template<typename Sequence, typename F> inline void
9191
for_each_type (F f)
9292
{
93-
BOOST_MPL_ASSERT (( boost::mpl::is_sequence<Sequence> ));
93+
static_assert(boost::mpl::is_sequence<Sequence>::type::value,
94+
"Given type is not a valid sequence.");
9495
using first = typename boost::mpl::begin<Sequence>::type;
9596
using last = typename boost::mpl::end<Sequence>::type;
9697
for_each_type_impl<std::is_same<first, last>::value>::template execute<first, last, F> (f);

common/include/pcl/point_struct_traits.h

+8-9
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
#pragma once
3939

40-
#include <boost/mpl/assert.hpp> // for BOOST_MPL_ASSERT_MSG
4140
#include <boost/mpl/identity.hpp> // for boost::mpl::identity
4241

4342
#include <boost/mpl/vector.hpp> // for boost::mpl::vector
@@ -111,8 +110,8 @@ struct name /** \cond NO_WARN_RECURSIVE */ : name<typename POD<PointT>::type, Ta
111110
// static const char value[];
112111

113112
// Avoid infinite compile-time recursion
114-
BOOST_MPL_ASSERT_MSG((!std::is_same<PointT, typename POD<PointT>::type>::value),
115-
POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT&));
113+
static_assert(!std::is_same<PointT, typename POD<PointT>::type>::value,
114+
"Point type not properly registered.");
116115
};
117116
} // namespace traits
118117
} // namespace pcl
@@ -143,8 +142,8 @@ struct offset /** \cond NO_WARN_RECURSIVE */ : offset<typename POD<PointT>::type
143142
// static const std::size_t value;
144143

145144
// Avoid infinite compile-time recursion
146-
BOOST_MPL_ASSERT_MSG((!std::is_same<PointT, typename POD<PointT>::type>::value),
147-
POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT&));
145+
static_assert(!std::is_same<PointT, typename POD<PointT>::type>::value,
146+
"Point type not properly registered.");
148147
};
149148
} // namespace traits
150149
} // namespace pcl
@@ -170,8 +169,8 @@ namespace traits
170169
// static const std::uint32_t size;
171170

172171
// Avoid infinite compile-time recursion
173-
BOOST_MPL_ASSERT_MSG((!std::is_same<PointT, typename POD<PointT>::type>::value),
174-
POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT&));
172+
static_assert(!std::is_same<PointT, typename POD<PointT>::type>::value,
173+
"Point type not properly registered.");
175174
};
176175
} // namespace traits
177176
} // namespace pcl
@@ -198,8 +197,8 @@ struct fieldList /** \cond NO_WARN_RECURSIVE */ : fieldList<typename POD<PointT>
198197
// using type = boost::mpl::vector<...>;
199198

200199
// Avoid infinite compile-time recursion
201-
BOOST_MPL_ASSERT_MSG((!std::is_same<PointT, typename POD<PointT>::type>::value),
202-
POINT_TYPE_NOT_PROPERLY_REGISTERED, (PointT&));
200+
static_assert(!std::is_same<PointT, typename POD<PointT>::type>::value,
201+
"Point type not properly registered.");
203202
};
204203
} // namespace traits
205204
} // namespace pcl

common/include/pcl/register_point_struct.h

+7-9
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
#endif
5252

5353
#include <pcl/point_struct_traits.h> // for pcl::traits::POD, POINT_CLOUD_REGISTER_FIELD_(NAME, OFFSET, DATATYPE), POINT_CLOUD_REGISTER_POINT_FIELD_LIST
54-
#include <boost/mpl/assert.hpp> // for BOOST_MPL_ASSERT_MSG
5554
#include <boost/preprocessor/seq/for_each.hpp> // for BOOST_PP_SEQ_FOR_EACH
5655
#include <boost/preprocessor/seq/transform.hpp> // for BOOST_PP_SEQ_TRANSFORM
5756
#include <boost/preprocessor/tuple/elem.hpp> // for BOOST_PP_TUPLE_ELEM
@@ -66,12 +65,13 @@
6665
BOOST_PP_CAT(POINT_CLOUD_REGISTER_POINT_STRUCT_X fseq, 0))
6766
/***/
6867

69-
#define POINT_CLOUD_REGISTER_POINT_WRAPPER(wrapper, pod) \
70-
BOOST_MPL_ASSERT_MSG(sizeof(wrapper) == sizeof(pod), POINT_WRAPPER_AND_POD_TYPES_HAVE_DIFFERENT_SIZES, (wrapper&, pod&)); \
71-
namespace pcl { \
72-
namespace traits { \
73-
template<> struct POD<wrapper> { using type = pod; }; \
74-
} \
68+
#define POINT_CLOUD_REGISTER_POINT_WRAPPER(wrapper, pod) \
69+
static_assert(sizeof(wrapper) == sizeof(pod), \
70+
"Point wrapper and POD types have different sizes."); \
71+
namespace pcl { \
72+
namespace traits { \
73+
template<> struct POD<wrapper> { using type = pod; }; \
74+
} \
7575
}
7676
/***/
7777

@@ -248,8 +248,6 @@ namespace pcl
248248
/***/
249249

250250
// Construct type traits given full sequence of (type, name, tag) triples
251-
// BOOST_MPL_ASSERT_MSG(std::is_pod<name>::value,
252-
// REGISTERED_POINT_TYPE_MUST_BE_PLAIN_OLD_DATA, (name));
253251
#define POINT_CLOUD_REGISTER_POINT_STRUCT_I(name, seq) \
254252
namespace pcl \
255253
{ \

0 commit comments

Comments
 (0)