refactor(Core/Misc): add braces and impove codestyle (#6402)

This commit is contained in:
Kargatum
2021-06-25 00:50:18 +07:00
committed by GitHub
parent 33c271cc7c
commit 3c24b511f2
72 changed files with 1486 additions and 401 deletions

View File

@@ -14,7 +14,8 @@
#include <vector>
template <typename T>
class CircularBuffer {
class CircularBuffer
{
public:
explicit CircularBuffer(size_t size) :
buf_(std::unique_ptr<T[]>(new T[size])),
@@ -77,13 +78,15 @@ public:
// the implementation of this function is simplified by the fact that head_ will never be lower than tail_
// when compared to the original implementation of this class
std::vector<T> content() {
std::vector<T> content()
{
std::lock_guard<std::mutex> lock(mutex_);
return std::vector<T>(buf_.get(), buf_.get() + size());
}
T peak_back() {
T peak_back()
{
std::lock_guard<std::mutex> lock(mutex_);
return empty() ? T() : buf_[tail_];