[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]
![]() |
vigra/memory.hxx | ![]() |
---|
00001 /************************************************************************/ 00002 /* */ 00003 /* Copyright 2002-2003 by Ullrich Koethe, Hans Meine */ 00004 /* Cognitive Systems Group, University of Hamburg, Germany */ 00005 /* */ 00006 /* This file is part of the VIGRA computer vision library. */ 00007 /* ( Version 1.2.0, Aug 07 2003 ) */ 00008 /* You may use, modify, and distribute this software according */ 00009 /* to the terms stated in the LICENSE file included in */ 00010 /* the VIGRA distribution. */ 00011 /* */ 00012 /* The VIGRA Website is */ 00013 /* http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/ */ 00014 /* Please direct questions, bug reports, and contributions to */ 00015 /* koethe@informatik.uni-hamburg.de */ 00016 /* */ 00017 /* THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY EXPRESS OR */ 00018 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ 00019 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ 00020 /* */ 00021 /************************************************************************/ 00022 00023 #ifndef VIGRA_MEMORY_HXX 00024 #define VIGRA_MEMORY_HXX 00025 00026 #include <vigra/metaprogramming.hxx> 00027 00028 namespace vigra { namespace detail { 00029 00030 template <class T> 00031 void destroy_n(T * p, int n, VigraTrueType /* isPOD */) 00032 { 00033 } 00034 00035 template <class T> 00036 void destroy_n(T * p, int n, VigraFalseType /* isPOD */) 00037 { 00038 T * end = p + n; 00039 for(; p != end; ++p) 00040 p->~T(); 00041 } 00042 00043 template <class T> 00044 void destroy_n(T * p, int n) 00045 { 00046 destroy_n(p, n, typename TypeTraits<T>::isPOD()); 00047 } 00048 00049 /********************************************************************/ 00050 00051 template <class T> 00052 void destroy(T * p, VigraTrueType /* isPOD */) 00053 { 00054 } 00055 00056 template <class T> 00057 void destroy(T * p, VigraFalseType /* isPOD */) 00058 { 00059 p->~T(); 00060 } 00061 00062 template <class T> 00063 void destroy(T * p) 00064 { 00065 destroy(p, typename TypeTraits<T>::isPOD()); 00066 } 00067 00068 } } // namespace vigra::detail 00069 00070 #endif // VIGRA_MEMORY_HXX
© Ullrich Köthe (koethe@informatik.uni-hamburg.de) |
html generated using doxygen and Python
|