parallel/stack: add clear and size queries
This commit is contained in:
parent
422a12258c
commit
34a5f7d52b
@ -85,6 +85,20 @@ namespace cruft::parallel {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::size_t capacity (void) const { return m_store.size (); }
|
||||
std::size_t size (void) const { return m_cursor; }
|
||||
bool empty (void) const { return m_cursor == 0; }
|
||||
|
||||
|
||||
void clear (void)
|
||||
{
|
||||
std::lock_guard lk (m_lock);
|
||||
for (auto &raw: store (contract::I_HAVE_LOCKED_THIS_STRUCTURE))
|
||||
raw.~ValueT ();
|
||||
m_cursor = 0;
|
||||
}
|
||||
|
||||
|
||||
// DO NOT make this enum easier to use. It's supposed to be annoying
|
||||
// so that people don't use it.
|
||||
enum class contract { I_HAVE_LOCKED_THIS_STRUCTURE };
|
||||
|
Loading…
Reference in New Issue
Block a user