moved initialization into constructor for compatibility with c++03

pull/1044/head^2
porkybrain 2015-04-16 15:57:30 +02:00
parent 250ce08712
commit cad87d11d4
1 changed files with 4 additions and 3 deletions

View File

@ -22,6 +22,7 @@
template <class T, int Size> template <class T, int Size>
class CircBuffer { class CircBuffer {
public: public:
CircBuffer():write(0), read(0){}
bool isFull() { bool isFull() {
return ((write + 1) % size == read); return ((write + 1) % size == read);
}; };
@ -53,9 +54,9 @@ public:
}; };
private: private:
volatile uint16_t write{0}; //in case older compilers are targeted this should be done in a constructor volatile uint16_t write;
volatile uint16_t read{0}; volatile uint16_t read;
static constexpr int size{Size+1}; static const int size = Size+1;
T buf[Size]; T buf[Size];
}; };