13 #ifndef __UT_StackBuffer_h__
14 #define __UT_StackBuffer_h__
18 template <
typename T,
size_t MAXBYTES = 256>
28 if (num_elems <= MAXELEMS)
31 myData =
new T[num_elems];
35 if (myData != myBuffer)
43 if (mySize == num_elems)
46 if (myData != myBuffer)
49 if (num_elems <= MAXELEMS)
52 myData =
new T[num_elems];
61 operator const T *()
const
63 return (
const T *)myData;
67 const T *
array()
const {
return myData; }
74 T &operator[](
exint i) {
return myData[i]; }
75 const T &operator[](
exint i)
const {
return myData[i]; }
91 static const int MAXELEMS = (MAXBYTES +
sizeof(
T) - 1)/
sizeof(
T);
98 #endif // __UT_StackBuffer_h__
void setSize(size_t num_elems)
UT_StackBuffer(size_t num_elems)
const T & operator()(exint i) const
const_iterator end() const
const_iterator begin() const