mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 03:23:33 +08:00
UAVCAN_IMPLEMENT_PLACEMENT_NEW
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
#include <uavcan/error.hpp>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
#include <uavcan/util/templates.hpp>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <uavcan/impl_constants.hpp>
|
||||
|
||||
#ifndef UAVCAN_IMPLEMENT_PLACEMENT_NEW
|
||||
# error UAVCAN_IMPLEMENT_PLACEMENT_NEW
|
||||
#endif
|
||||
|
||||
#if UAVCAN_IMPLEMENT_PLACEMENT_NEW
|
||||
|
||||
inline void* operator new (std::size_t, void* ptr) throw()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
inline void* operator new[](std::size_t, void* ptr) throw()
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline void operator delete (void*, void*) throw() { }
|
||||
inline void operator delete[](void*, void*) throw() { }
|
||||
|
||||
#else
|
||||
# include <new>
|
||||
#endif
|
||||
Reference in New Issue
Block a user