[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] Re: TeXmacs port to IRIX
From: |
Joris van der Hoeven |
Subject: |
Re: [Texmacs-dev] Re: TeXmacs port to IRIX |
Date: |
Tue, 14 Jan 2003 16:33:20 +0100 (MET) |
> > #if CONFIG_USE_VLA
> > #define VARIABLE_LENGTH_ARRAY(TYPE,NAME,NUMBER) TYPE NAME[NUMBER]
> > #else
> > #define VARIABLE_LENGTH_ARRAY(TYPE,NAME,NUMBER) fast_array<TYPE>
> > NAME(NUMBER);
> > #endif
> >
> > template<class T> class fast_array<T> {
> > T *a;
> > public:
> > inline fast_array(int n) { this->a = new T[n]; }
> > inline T& operator[] (const int i) { return this->a[i]; }
> > inline ~fast_array() { delete[] this->a; }
> > };
> >
> > Used as
> >
> > VARIABLE_LENGTH_ARRAY(char, data, byte_width * h);
I agree with this solution.
Maybe a shorter name for the macro though...