Add size query to mpmc_queue
This commit is contained in:
parent
01e78a1a01
commit
4f379d75ec
@ -122,6 +122,8 @@ namespace rexy{
|
||||
|
||||
void pop(reference t);
|
||||
bool try_pop(reference t);
|
||||
|
||||
size_type size(void)const;
|
||||
private:
|
||||
constexpr size_type rotation_cnt(size_type t);
|
||||
};
|
||||
|
||||
@ -209,6 +209,10 @@ namespace rexy{
|
||||
}
|
||||
}
|
||||
template<class T>
|
||||
auto mpmc_queue<T>::size(void)const -> size_type{
|
||||
return m_slots.size();
|
||||
}
|
||||
template<class T>
|
||||
constexpr auto mpmc_queue<T>::rotation_cnt(size_type t) -> size_type{
|
||||
return (t / m_slots.capacity());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user