mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-18 11:39:02 +02:00
Supported placement new.
This commit is contained in:
@@ -165,7 +165,24 @@ public:
|
|||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
void swap(zone& o);
|
void swap(zone& o);
|
||||||
|
static void* operator new(std::size_t size) throw(std::bad_alloc)
|
||||||
|
{
|
||||||
|
void* p = ::malloc(size);
|
||||||
|
if (!p) throw std::bad_alloc();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
static void operator delete(void *p) throw()
|
||||||
|
{
|
||||||
|
::free(p);
|
||||||
|
}
|
||||||
|
static void* operator new(std::size_t size, void* place) throw()
|
||||||
|
{
|
||||||
|
return ::operator new(size, place);
|
||||||
|
}
|
||||||
|
static void operator delete(void* p, void* place) throw()
|
||||||
|
{
|
||||||
|
::operator delete(p, place);
|
||||||
|
}
|
||||||
<%0.upto(GENERATION_LIMIT) {|i|%>
|
<%0.upto(GENERATION_LIMIT) {|i|%>
|
||||||
template <typename T<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
|
template <typename T<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
|
||||||
T* allocate(<%=(1..i).map{|j|"A#{j} a#{j}"}.join(', ')%>);
|
T* allocate(<%=(1..i).map{|j|"A#{j} a#{j}"}.join(', ')%>);
|
||||||
|
Reference in New Issue
Block a user