placement_new.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
3  */
4 
5 #ifndef UAVCAN_UTIL_PLACEMENT_NEW_HPP_INCLUDED
6 #define UAVCAN_UTIL_PLACEMENT_NEW_HPP_INCLUDED
7 
8 #include <cstddef>
10 
11 /*
12  * Some embedded C++ implementations don't implement the placement new operator.
13  * Define UAVCAN_IMPLEMENT_PLACEMENT_NEW to apply this workaround.
14  */
15 
16 #ifndef UAVCAN_IMPLEMENT_PLACEMENT_NEW
17 # error UAVCAN_IMPLEMENT_PLACEMENT_NEW
18 #endif
19 
20 #if UAVCAN_IMPLEMENT_PLACEMENT_NEW
21 
22 inline void* operator new (std::size_t, void* ptr) throw()
23 {
24  return ptr;
25 }
26 inline void* operator new[](std::size_t, void* ptr) throw()
27 {
28  return ptr;
29 }
30 
31 inline void operator delete (void*, void*) throw() { }
32 inline void operator delete[](void*, void*) throw() { }
33 
34 #else
35 # include <new>
36 #endif
37 
38 #endif // UAVCAN_UTIL_PLACEMENT_NEW_HPP_INCLUDED
std::size_t
unsigned long size_t
Definition: coverity_scan_model.cpp:19
build_config.hpp


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:02