Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: UAVCAN UAVCAN_Subscriber
placement_new.hpp
00001 /* 00002 * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com> 00003 */ 00004 00005 #ifndef UAVCAN_UTIL_PLACEMENT_NEW_HPP_INCLUDED 00006 #define UAVCAN_UTIL_PLACEMENT_NEW_HPP_INCLUDED 00007 00008 #include <cstddef> 00009 #include <uavcan/build_config.hpp> 00010 00011 /* 00012 * Some embedded C++ implementations don't implement the placement new operator. 00013 * Define UAVCAN_IMPLEMENT_PLACEMENT_NEW to apply this workaround. 00014 */ 00015 00016 #ifndef UAVCAN_IMPLEMENT_PLACEMENT_NEW 00017 # error UAVCAN_IMPLEMENT_PLACEMENT_NEW 00018 #endif 00019 00020 #if UAVCAN_IMPLEMENT_PLACEMENT_NEW 00021 00022 inline void* operator new (std::size_t, void* ptr) throw() 00023 { 00024 return ptr; 00025 } 00026 inline void* operator new[](std::size_t, void* ptr) throw() 00027 { 00028 return ptr; 00029 } 00030 00031 inline void operator delete (void*, void*) throw() { } 00032 inline void operator delete[](void*, void*) throw() { } 00033 00034 #else 00035 # include <new> 00036 #endif 00037 00038 #endif // UAVCAN_UTIL_PLACEMENT_NEW_HPP_INCLUDED
Generated on Tue Jul 12 2022 17:17:33 by
