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