Skip to content

Commit 1db7277

Browse files
committed
Fixed style issues
Signed-off-by: Ali Ashkani Nia <[email protected]>
1 parent 0e662e5 commit 1db7277

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Diff for: demo_nodes_cpp/src/topics/allocator_tutorial.cpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#include <chrono>
1616
#include <list>
1717
#include <memory>
18+
#include <memory_resource>
1819
#include <string>
1920
#include <utility>
20-
#include <memory_resource>
2121

2222
#include "rclcpp/rclcpp.hpp"
2323
#include "rclcpp/allocator/allocator_common.hpp"
@@ -30,24 +30,29 @@ using namespace std::chrono_literals;
3030
static uint32_t num_allocs = 0;
3131
static uint32_t num_deallocs = 0;
3232
// A very simple custom memory resource. Counts calls to do_allocate and do_deallocate.
33-
class CustomMemoryResource : public std::pmr::memory_resource {
33+
class CustomMemoryResource : public std::pmr::memory_resource
34+
{
3435
private:
35-
void* do_allocate(std::size_t bytes, std::size_t alignment) override {
36+
void * do_allocate(std::size_t bytes, std::size_t alignment) override
37+
{
3638
num_allocs++;
3739
(void)alignment;
3840
return std::malloc(bytes);
3941
}
4042

41-
void do_deallocate(void* p, std::size_t bytes,
42-
std::size_t alignment) override {
43+
void do_deallocate(
44+
void * p, std::size_t bytes,
45+
std::size_t alignment) override
46+
{
4347
num_deallocs++;
4448
(void)bytes;
4549
(void)alignment;
4650
std::free(p);
4751
}
4852

4953
bool do_is_equal(
50-
const std::pmr::memory_resource& other) const noexcept override {
54+
const std::pmr::memory_resource & other) const noexcept override
55+
{
5156
return this == &other;
5257
}
5358
};

0 commit comments

Comments
 (0)