mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
Added 'poke' and 'clear' methods to fifo template
This commit is contained in:
parent
d9f7237a7a
commit
f1a1b77595
@ -428,7 +428,7 @@ public:
|
||||
fifo()
|
||||
: std::array<T, N>()
|
||||
, m_head(this->begin())
|
||||
, m_tail(this->end())
|
||||
, m_tail(this->begin())
|
||||
, m_empty(true)
|
||||
{
|
||||
static_assert(0U < N, "FIFO must have at least one element");
|
||||
@ -513,11 +513,28 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
void poke(T &v)
|
||||
{
|
||||
*m_tail = v;
|
||||
}
|
||||
|
||||
void poke(T &&v)
|
||||
{
|
||||
*m_tail = std::move(v);
|
||||
}
|
||||
|
||||
T const &peek() const
|
||||
{
|
||||
return *m_head;
|
||||
}
|
||||
|
||||
void clear() const
|
||||
{
|
||||
m_head = m_tail = this->begin();
|
||||
m_empty = true;
|
||||
return *m_head;
|
||||
}
|
||||
|
||||
private:
|
||||
typename fifo::iterator m_head, m_tail;
|
||||
bool m_empty;
|
||||
|
Loading…
Reference in New Issue
Block a user