xo-gc stack: fix mutation setup + xo-reader2 utest
This commit is contained in:
parent
05a6aa9425
commit
211bc93c85
3 changed files with 19 additions and 1 deletions
|
|
@ -76,6 +76,11 @@ namespace xo {
|
||||||
static DArray * _empty(obj<AAllocator> mm,
|
static DArray * _empty(obj<AAllocator> mm,
|
||||||
size_type cap);
|
size_type cap);
|
||||||
|
|
||||||
|
/** ofp version of _empty(mm,cap) **/
|
||||||
|
template <typename AFacet = AGCObject>
|
||||||
|
static obj<AFacet,DArray> empty(obj<AAllocator> mm,
|
||||||
|
size_type cap);
|
||||||
|
|
||||||
/** create copy of @p src using memory from @p mm
|
/** create copy of @p src using memory from @p mm
|
||||||
* with capacity for @p new_cap elements
|
* with capacity for @p new_cap elements
|
||||||
**/
|
**/
|
||||||
|
|
@ -198,6 +203,15 @@ namespace xo {
|
||||||
///@}
|
///@}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename AFacet>
|
||||||
|
obj<AFacet,DArray>
|
||||||
|
DArray::empty(obj<AAllocator> mm, DArray::size_type cap)
|
||||||
|
{
|
||||||
|
DArray * retval = _empty(mm, cap);
|
||||||
|
|
||||||
|
return obj<AFacet,DArray>(retval);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
requires (std::convertible_to<Args, obj<DArray::AGCObject>> && ...)
|
requires (std::convertible_to<Args, obj<DArray::AGCObject>> && ...)
|
||||||
DArray *
|
DArray *
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,8 @@ namespace xo {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DArray::push_back(obj<AAllocator> mm, obj<AGCObject> elt) noexcept
|
DArray::push_back(obj<AAllocator> mm,
|
||||||
|
obj<AGCObject> elt) noexcept
|
||||||
{
|
{
|
||||||
if (size_ >= capacity_) {
|
if (size_ >= capacity_) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,9 @@ namespace xo {
|
||||||
auto alloc = with_facet<AAllocator>::mkobj(&arena);
|
auto alloc = with_facet<AAllocator>::mkobj(&arena);
|
||||||
obj<AAllocator> null_mm;
|
obj<AAllocator> null_mm;
|
||||||
|
|
||||||
|
REQUIRE(!null_mm.data());
|
||||||
|
REQUIRE(!null_mm._has_null_vptr()); // any
|
||||||
|
|
||||||
DArray * arr = DArray::_empty(alloc, 16);
|
DArray * arr = DArray::_empty(alloc, 16);
|
||||||
REQUIRE(arr != nullptr);
|
REQUIRE(arr != nullptr);
|
||||||
REQUIRE(arr->capacity() == 16);
|
REQUIRE(arr->capacity() == 16);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue