template with integer parameter and special implementation for N=1
hi all,
i need for an project an "finiteQue" class. what save the last N
pushed values and forgot the other ones..
like this:
template <class T,std::size_t N>
class FinitQue {
public:
inline void push_front(const T newDat);
inline T get(std::size_t idx) const ;
inline T operator[](std::size_t idx);
inline T get_back() const;
inline T get_front() const;
inline std::size_t getAmount() const;
inline std::size_t getSize() const;
inline bool operator==(const FinitQue<T,N> & h2) const;
};
Now I whant to give two different implementations, one for N == 1
(data of type T) and one for N>=1 (Array of fix size)
how to do this? it is REALY speed critical.. with dynamic memory the
runtime of my simulation is going up by times 4!!!
THX for you
marco
|