Eneboo - Documentación para desarrolladores
|
00001 // -*- C++ -*- 00002 00003 #ifndef _ARRAY_H_ 00004 #define _ARRAY_H_ 00005 00006 /* 00007 00008 Heap Layers: An Extensible Memory Allocation Infrastructure 00009 00010 Copyright (C) 2000-2003 by Emery Berger 00011 http://www.cs.umass.edu/~emery 00012 emery@cs.umass.edu 00013 00014 This program is free software; you can redistribute it and/or modify 00015 it under the terms of the GNU General Public License as published by 00016 the Free Software Foundation; either version 2 of the License, or 00017 (at your option) any later version. 00018 00019 This program is distributed in the hope that it will be useful, 00020 but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License 00025 along with this program; if not, write to the Free Software 00026 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00027 00028 */ 00029 00030 #include <cassert> 00031 00032 namespace Hoard { 00033 00034 template <int N, typename T> 00035 class Array { 00036 public: 00037 00038 inline T& operator()(int index) { 00039 assert (index >= 0); 00040 assert (index < N); 00041 return _item[index]; 00042 } 00043 00044 inline const T& operator()(int index) const { 00045 assert (index >= 0); 00046 assert (index < N); 00047 return _item[index]; 00048 } 00049 00050 private: 00051 00052 T _item[N]; 00053 00054 }; 00055 00056 } 00057 00058 00059 #endif