added gc_object.
git-svn-id: svn://10.0.0.236/trunk@65588 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
7c4cc6ee74
commit
38d43f6703
@ -146,6 +146,18 @@ namespace JavaScript {
|
||||
|
||||
static void collect() { GC_gcollect(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic base class for objects allocated using a gc_allocator.
|
||||
*/
|
||||
template <typename T> class gc_object {
|
||||
public:
|
||||
void* operator new(size_t) { return alloc.allocate(1, 0); }
|
||||
void operator delete(void* /* ptr */) {}
|
||||
private:
|
||||
static gc_allocator<T> alloc;
|
||||
};
|
||||
template <typename T> gc_allocator<T> gc_object<T>::alloc;
|
||||
}
|
||||
|
||||
#endif /* gc_allocator_h */
|
||||
|
||||
@ -146,6 +146,18 @@ namespace JavaScript {
|
||||
|
||||
static void collect() { GC_gcollect(); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Generic base class for objects allocated using a gc_allocator.
|
||||
*/
|
||||
template <typename T> class gc_object {
|
||||
public:
|
||||
void* operator new(size_t) { return alloc.allocate(1, 0); }
|
||||
void operator delete(void* /* ptr */) {}
|
||||
private:
|
||||
static gc_allocator<T> alloc;
|
||||
};
|
||||
template <typename T> gc_allocator<T> gc_object<T>::alloc;
|
||||
}
|
||||
|
||||
#endif /* gc_allocator_h */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user