xo-interpreter2 stack: + literal array parsing
This commit is contained in:
parent
5f3000693e
commit
c05b301742
2 changed files with 19 additions and 2 deletions
|
|
@ -112,6 +112,13 @@ namespace xo {
|
|||
**/
|
||||
bool resize(size_type new_size) noexcept;
|
||||
|
||||
/** reduce array capacity to current array size
|
||||
*
|
||||
* note: with X1Collector, capacity is reduced but memory not recycled
|
||||
* until next collection
|
||||
**/
|
||||
void shrink_to_fit() noexcept;
|
||||
|
||||
///@}
|
||||
/** @defgroup darray-conversion-operators conversion operators **/
|
||||
///@{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ namespace xo {
|
|||
}
|
||||
|
||||
bool
|
||||
DArray::push_back(obj<AGCObject> elt) noexcept {
|
||||
DArray::push_back(obj<AGCObject> elt) noexcept
|
||||
{
|
||||
if (size_ >= capacity_) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
@ -85,7 +86,8 @@ namespace xo {
|
|||
}
|
||||
|
||||
bool
|
||||
DArray::resize(size_type new_z) noexcept {
|
||||
DArray::resize(size_type new_z) noexcept
|
||||
{
|
||||
if (new_z >= capacity_) {
|
||||
return false;
|
||||
} else if (new_z > size_) {
|
||||
|
|
@ -97,6 +99,14 @@ namespace xo {
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
DArray::shrink_to_fit() noexcept
|
||||
{
|
||||
if (capacity_ > size_) {
|
||||
this->capacity_ = size_;
|
||||
}
|
||||
}
|
||||
|
||||
// printing support
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue