Loading...
Searching...
No Matches
Ring.hpp
1#pragma once
2#include <boost/circular_buffer.hpp>
3
4#include <algorithm>
5#include <cstddef>
6#include <limits>
7#include <utility>
8
9namespace Ui::Monitor
10{
16template <typename T, typename V>
18 boost::circular_buffer<T>& ring, V&& v,
19 std::size_t limit = std::numeric_limits<std::size_t>::max())
20{
21 if(ring.full() && ring.capacity() < limit)
22 ring.set_capacity(std::min(limit, std::max<std::size_t>(16, ring.capacity() * 2)));
23 ring.push_back(std::forward<V>(v));
24}
25}
Definition BufferDecode.hpp:16
void pushRing(boost::circular_buffer< T > &ring, V &&v, std::size_t limit=std::numeric_limits< std::size_t >::max())
Definition Ring.hpp:17