1 // Created on: 2012-01-19
2 // Created by: Dmitry BOBYLEV
3 // Copyright (c) 2012-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _NCollection_DefineAlloc_HeaderFile
17 # define _NCollection_DefineAlloc_HeaderFile
19 #include <NCollection_BaseAllocator.hxx>
21 // Macro to overload placement new and delete operators for NCollection allocators.
22 // For Borland C and old SUN compilers do not define placement delete
23 // as it is not supported.
24 # if defined(__BORLANDC__) || (defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
25 # define DEFINE_NCOLLECTION_ALLOC \
26 void* operator new (size_t theSize, \
27 const Handle(NCollection_BaseAllocator)& theAllocator) \
29 return theAllocator->Allocate(theSize); \
32 # define DEFINE_NCOLLECTION_ALLOC \
33 void* operator new (size_t theSize, \
34 const Handle(NCollection_BaseAllocator)& theAllocator) \
36 return theAllocator->Allocate(theSize); \
38 void operator delete (void* theAddress, \
39 const Handle(NCollection_BaseAllocator)& theAllocator) \
41 theAllocator->Free(theAddress); \