alloc/stack: add capacity/size/remain implementations
This commit is contained in:
parent
8ea208daea
commit
5601c1e9c4
@ -99,3 +99,27 @@ stack::reset (void)
|
||||
{
|
||||
m_cursor = m_begin;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
size_t
|
||||
stack::capacity (void) const
|
||||
{
|
||||
return m_end - m_begin;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
size_t
|
||||
stack::size (void) const
|
||||
{
|
||||
return m_cursor - m_begin;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
size_t
|
||||
stack::remain (void) const
|
||||
{
|
||||
return capacity () - size ();
|
||||
}
|
||||
|
@ -39,6 +39,10 @@ namespace util { namespace alloc {
|
||||
|
||||
void reset (void);
|
||||
|
||||
size_t capacity (void) const;
|
||||
size_t size (void) const;
|
||||
size_t remain (void) const;
|
||||
|
||||
private:
|
||||
char *m_begin, *m_end, *m_cursor;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user