If a calculation method needs to return multiple time sequences this can become unwieldy, for example
void Get_a_and_b(TimeSequence** a, TimeSequence** b)
{
// Get memfactory and time range somehow
BinMemFactory memfactory = ...
TimeRange rt = ...
*a = TSFactory.New(tr, memfactory);
*b = TSFactory.New(tr, memfactory);
// Operations will now involve complicated-looking things like
size_t n = (*a)->NumFrames();
}
And even more so when a vector is needed.
If a time sequence can be re-allocated then it could be passed by reference, and then we can say things like a.NumFrames() which is much more concise. This has the added benefit that use of auto-pointers can be avoided when used locally - time sequences can be allocated on the heap (and it's only the metadata that would use the heap, everything else will use memory allocation via the mem factory).
If a calculation method needs to return multiple time sequences this can become unwieldy, for example
And even more so when a vector is needed.
If a time sequence can be re-allocated then it could be passed by reference, and then we can say things like
a.NumFrames()
which is much more concise. This has the added benefit that use of auto-pointers can be avoided when used locally - time sequences can be allocated on the heap (and it's only the metadata that would use the heap, everything else will use memory allocation via the mem factory).