common array: revise the interface.

Implement a pair of access methods: last() and first().
This commit is contained in:
Hermet Park 2023-06-29 17:07:18 +09:00 committed by Hermet Park
parent 65f178620e
commit b876427325
2 changed files with 9 additions and 4 deletions

View file

@ -73,9 +73,14 @@ struct Array
return data + count;
}
T* last() const
T& last() const
{
return data + count - 1;
return data[count - 1];
}
T& first() const
{
return data[0];
}
void pop()

View file

@ -675,8 +675,8 @@ TvgBinCounter TvgSaver::serializeChildren(Iterator* it, const Matrix* pTransform
if (child->identifier() == TVG_CLASS_ID_SHAPE) {
//only dosable if the previous child is a shape.
auto target = children.last();
if ((*target)->identifier() == TVG_CLASS_ID_SHAPE) {
if (_merge((Shape*)child, (Shape*)*target)) {
if (target->identifier() == TVG_CLASS_ID_SHAPE) {
if (_merge((Shape*)child, (Shape*)target)) {
continue;
}
}