Commit Graph

4 Commits

Author SHA1 Message Date
Mark Olesen
0fb2c8eb1c STYLE: update applications/tests to use SpanStream/CharStream 2023-10-11 18:11:37 +00:00
Mark Olesen
ce1260cf70 ENH: improve DynamicList shrink and swapping
- shrink_to_fit()
  corresponds to std::vector naming.
  For DynamicList it is a *binding* request.

- shrink_unsafe()
  simply adjusts the capacity() to match the
  current size() without forcing a re-allocation.

  Useful when collapsing to a non-dynamic list to avoid reallocation
  and copying contents. The memory cleanup will still occur properly
  at a later stage.

- DynamicList::swap(List&)
  simple recovery of content into a non-dynamic List that also
  ensures that the capacity is correctly updated.

STYLE: promote List::capacity() to public visibility (like std::vector)

STYLE: remove unused expandStorage() method

- simply a wrapper for resize(capacity())
2023-10-11 18:11:37 +00:00
Mark Olesen
500ec9dd12 ENH: more consistent order of ITstream constructor parameters 2022-09-07 16:25:45 +02:00
Mark Olesen
b8a4b7e80d ENH: additional 'nocopy' methods for List resize/reserve methods
- the size of a List often requires adjustment prior to an operation,
  but old values (if any) are not of interest and will be overwritten.

  In these cases can use the _nocopy versions to avoid additional memory
  overhead of the intermediate list and the copy/move overhead of
  retaining the old values (that we will subsequently discard anyhow).

  No equivalent for PtrList/UPtrList - this would be too fragile.

- add swap DynamicField with DynamicList

BUG: fixed Dynamic{Field,List} setCapacity corner case

- for the case when the newly requested capacity coincides with the
  current addressable size, the resize of the underlying list would have
  been bypassed - ie, the real capacity was not actually changed.

- remove (unused) PtrDynList setCapacity method as too fragile
2021-10-29 17:04:51 +02:00