initialize buffer optionally with provided value

This commit is contained in:
Ahmet Inan 2020-10-13 15:49:58 +02:00
commit b934d9fe4e

View file

@ -14,10 +14,10 @@ class Delay
TYPE buf[NUM]; TYPE buf[NUM];
int pos; int pos;
public: public:
Delay() : pos(0) Delay(TYPE init = 0) : pos(0)
{ {
for (int i = 0; i < NUM; ++i) for (int i = 0; i < NUM; ++i)
buf[i] = 0; buf[i] = init;
} }
TYPE operator () (TYPE input) TYPE operator () (TYPE input)
{ {