memdefau.h

来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 29 行

H
29
字号
/****************************************************************************
File: memdefault.h -- JAM_MemDefault struct provides default allocation routines

Description:
   The JAM library's "Controlled" containers take a class parameter which
   will provide memory.  The class should have a "void* alloc(size_t)"
   and a "void free(void*)" static member function.  JAM_MemDefault
   just defines them as using the global operator new()/delete().

Usage:

Notes:
   
History:
01 Sep 1992 Jam      created (ref. Stroustrup2)
   
****************************************************************************/     
#ifndef JAM_MemDefault_H
#define JAM_MemDefault_H

#include <stddef.h>     // for size_t

struct JAM_MemDefault {
   static void* alloc(size_t s) { return operator new(s); }
   static void free(void* p) { operator delete(p); }
};

#endif // JAM_MemDefault_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?