0024530: TKMesh - remove unused package IntPoly
[occt.git] / src / NCollection / NCollection_DefineAlloc.hxx
CommitLineData
6aca4d39 1// Created on: 2012-01-19
b311480e 2// Created by: Dmitry BOBYLEV
6aca4d39 3// Copyright (c) 2012-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
973c2be1 7// This library is free software; you can redistribute it and / or modify it
8// under the terms of the GNU Lesser General Public 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
1c35b92f 16#ifndef _NCollection_DefineAlloc_HeaderFile
17# define _NCollection_DefineAlloc_HeaderFile
18
60d4560d 19#include <NCollection_BaseAllocator.hxx>
20
1c35b92f 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) \
28 { \
29 return theAllocator->Allocate(theSize); \
30 }
31# else
32# define DEFINE_NCOLLECTION_ALLOC \
33 void* operator new (size_t theSize, \
34 const Handle(NCollection_BaseAllocator)& theAllocator) \
35 { \
36 return theAllocator->Allocate(theSize); \
37 } \
38 void operator delete (void* theAddress, \
39 const Handle(NCollection_BaseAllocator)& theAllocator) \
40 { \
41 theAllocator->Free(theAddress); \
42 }
43# endif
44
e2e80ff7 45#endif