Topic: Template <class T, int dim> array ....Please help
Author: abed@saturn.wustl.edu (Abed M. Hammoud)
Date: 1 Dec 1993 22:41:57 GMT Raw View
Hello, I have designed a two dimensional array class I call array<T>,
and a 1D array class I call vector<T>. I would like to change the template
definitions so I have
template <class T, int dim = 1>
class array{
};
and
template <class T, int dim = 2>
class array{
};
so instead of writing array<float>, vector<float> I can say
array<float, 1>, array<float, 2>...etc.
Is this possible in C++. Is this a feature that will be added
(a possible extension). Any help would be appreciated.
(Note: I am using g++ 2.5.2 with libg++ 2.5.1) on a sun sparc station.
Thanks,
+-------------------------------------------------+-----------------------+
|Abed M. Hammoud (KB0INX) | abed@saturn.wustl.edu |
|Washington University. | Office: |
|Electronic Systems & Signals Research Laboratory.| -Voice:(314) 935-7547 |
|Department of Electrical/Biomedical Engineering. | -FAX: (314) 935-4842 |
|Campus Box 1161, One Brookings Drive. | |
|St. Louis, MO , 63130 USA | |
+-------------------------------------------------+-----------------------+