source: proiecte/swift/trunk/lib/hoard-371/src/array.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 1.3 KB
Line 
1// -*- C++ -*-
2
3#ifndef _ARRAY_H_
4#define _ARRAY_H_
5
6/*
7
8  Heap Layers: An Extensible Memory Allocation Infrastructure
9 
10  Copyright (C) 2000-2003 by Emery Berger
11  http://www.cs.umass.edu/~emery
12  emery@cs.umass.edu
13 
14  This program is free software; you can redistribute it and/or modify
15  it under the terms of the GNU General Public License as published by
16  the Free Software Foundation; either version 2 of the License, or
17  (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  GNU General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with this program; if not, write to the Free Software
26  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
28*/
29
30#include <assert.h>
31
32namespace Hoard {
33
34template <int N, typename T>
35class Array {
36public:
37
38  inline T& operator()(int index) {
39    assert (index >= 0);
40    assert (index < N);
41    return _item[index];
42  }
43
44  inline const T& operator()(int index) const {
45    assert (index >= 0);
46    assert (index < N);
47    return _item[index];
48  }
49
50private:
51
52  T _item[N];
53
54};
55
56}
57
58
59#endif
Note: See TracBrowser for help on using the repository browser.