Skip to content

Commit 74c26e3

Browse files
Ivo Ivanovfujitatomoya
authored andcommitted
Reformat
Signed-off-by: Ivo Ivanov <[email protected]>
1 parent bdcac45 commit 74c26e3

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

rclcpp/include/rclcpp/publisher.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,12 @@ class Publisher : public PublisherBase
574574
std::unique_ptr<PublishedType, PublishedTypeDeleter>
575575
duplicate_type_adapt_message_as_unique_ptr(const PublishedType & msg)
576576
{
577-
/// Assert that the published type has no overloaded operator new since this leads to new/delete mismatch (see https://github.com/ros2/rclcpp/issues/2951)
578-
static_assert(!detail::has_overloaded_operator_new_v<PublishedType>,
579-
"When publishing by value (i.e. when calling publish(const T& msg)), the published message type must not have an overloaded operator new. In this case, please use the publish(std::unique_ptr<T> msg) method instead.");
577+
/// Assert that the published type has no overloaded operator new since this leads to
578+
/// new/delete mismatch (see https://github.com/ros2/rclcpp/issues/2951)
579+
static_assert(!detail::has_overloaded_operator_new_v<PublishedType>,
580+
"When publishing by value (i.e. when calling publish(const T& msg)), the published message"
581+
"type must not have an overloaded operator new. In this case, please use the"
582+
"publish(std::unique_ptr<T> msg) method instead.");
580583
auto ptr = PublishedTypeAllocatorTraits::allocate(published_type_allocator_, 1);
581584
PublishedTypeAllocatorTraits::construct(published_type_allocator_, ptr, msg);
582585
return std::unique_ptr<PublishedType, PublishedTypeDeleter>(ptr, published_type_deleter_);

rclcpp/include/rclcpp/type_adapter.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define RCLCPP__TYPE_ADAPTER_HPP_
1717

1818
#include <type_traits>
19-
#include <new> // For std::align_val_t
19+
#include <new>
2020

2121
namespace rclcpp
2222
{
@@ -129,20 +129,20 @@ struct assert_type_pair_is_specialized_type_adapter
129129
"No type adapter for this custom type/ros message type pair");
130130
};
131131

132-
template <typename, typename = void>
132+
template<typename, typename = void>
133133
struct has_overloaded_operator_new : std::false_type {};
134-
template <typename T>
134+
template<typename T>
135135
struct has_overloaded_operator_new<T, std::void_t<
136-
decltype(T::operator new(std::size_t()))
137-
>> : std::true_type {};
136+
decltype(T::operator new(std::size_t()))
137+
>>: std::true_type {};
138138

139139
/// Aligned operator new (C++17)
140140
template<class T>
141141
struct has_overloaded_operator_new<T,
142-
std::void_t<decltype( T::operator new(std::size_t(), std::align_val_t()) )>>
142+
std::void_t<decltype( T::operator new(std::size_t(), std::align_val_t()) )>>
143143
: std::true_type {};
144144

145-
template <typename T>
145+
template<typename T>
146146
inline constexpr bool has_overloaded_operator_new_v = has_overloaded_operator_new<T>::value;
147147

148148
} // namespace detail

0 commit comments

Comments
 (0)