object.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2001-2006, William Joseph.
00003 All Rights Reserved.
00004 
00005 This file is part of GtkRadiant.
00006 
00007 GtkRadiant is free software; you can redistribute it and/or modify
00008 it under the terms of the GNU General Public License as published by
00009 the Free Software Foundation; either version 2 of the License, or
00010 (at your option) any later version.
00011 
00012 GtkRadiant is distributed in the hope that it will be useful,
00013 but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with GtkRadiant; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 */
00021 
00022 #if !defined(INCLUDED_GENERIC_OBJECT_H)
00023 #define INCLUDED_GENERIC_OBJECT_H
00024 
00029 
00030 #include <new>
00031 
00032 template<typename Type>
00033 inline void constructor(Type& object) {
00034     new(&object) Type();
00035 }
00036 
00037 template<typename Type, typename T1>
00038 inline void constructor(Type& object, const T1& t1) {
00039     new(&object) Type(t1);
00040 }
00041 
00042 template<typename Type, typename T1, typename T2>
00043 inline void constructor(Type& object, const T1& t1, const T2& t2) {
00044     new(&object) Type(t1, t2);
00045 }
00046 
00047 template<typename Type, typename T1, typename T2, typename T3>
00048 inline void constructor(Type& object, const T1& t1, const T2& t2, const T3& t3) {
00049     new(&object) Type(t1, t2, t3);
00050 }
00051 
00052 template<typename Type, typename T1, typename T2, typename T3, typename T4>
00053 inline void constructor(Type& object, const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
00054     new(&object) Type(t1, t2, t3, t4);
00055 }
00056 
00057 template<typename Type, typename T1, typename T2, typename T3, typename T4, typename T5>
00058 inline void constructor(Type& object, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5) {
00059     new(&object) Type(t1, t2, t3, t4, t5);
00060 }
00061 
00062 template<typename Type, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
00063 inline void constructor(Type& object, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6) {
00064     new(&object) Type(t1, t2, t3, t4, t5, t6);
00065 }
00066 
00067 template<typename Type, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
00068 inline void constructor(Type& object, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7) {
00069     new(&object) Type(t1, t2, t3, t4, t5, t6, t7);
00070 }
00071 
00072 template<typename Type, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
00073 inline void constructor(Type& object, const T1& t1, const T2& t2, const T3& t3, const T4& t4, const T5& t5, const T6& t6, const T7& t7, const T8& t8) {
00074     new(&object) Type(t1, t2, t3, t4, t5, t6, t7, t8);
00075 }
00076 
00077 template<typename Type>
00078 inline void destructor(Type& object) {
00079     object.~Type();
00080 }
00081 
00082 
00083 
00084 #endif

Generated by  doxygen 1.6.2