本文整理汇总了C++中PropertyNameArray::end方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyNameArray::end方法的具体用法?C++ PropertyNameArray::end怎么用?C++ PropertyNameArray::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyNameArray
的用法示例。
在下文中一共展示了PropertyNameArray::end方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compactForSorting
unsigned ArrayInstance::compactForSorting()
{
JSValue *undefined = jsUndefined();
unsigned o = 0;
for (unsigned i = 0; i != storageLength; ++i) {
JSValue *v = storage[i];
if (v && v != undefined) {
if (o != i)
storage[o] = v;
o++;
}
}
PropertyNameArray sparseProperties;
_prop.getSparseArrayPropertyNames(sparseProperties);
unsigned newLength = o + sparseProperties.size();
if (newLength > storageLength)
resizeStorage(newLength);
PropertyNameArrayIterator end = sparseProperties.end();
for (PropertyNameArrayIterator it = sparseProperties.begin(); it != end; ++it) {
Identifier name = *it;
storage[o] = getDirect(name);
_prop.remove(name);
o++;
}
if (newLength != storageLength)
memset(storage + o, 0, sizeof(JSValue *) * (storageLength - o));
return o;
}
示例2: setLength
void ArrayInstance::setLength(unsigned newLength, ExecState *exec)
{
if (newLength <= storageLength) {
resizeStorage(newLength);
}
if (newLength < length) {
PropertyNameArray sparseProperties;
_prop.getSparseArrayPropertyNames(sparseProperties);
PropertyNameArrayIterator end = sparseProperties.end();
for (PropertyNameArrayIterator it = sparseProperties.begin(); it != end; ++it) {
Identifier name = *it;
bool ok;
unsigned index = name.toArrayIndex(&ok);
if (ok && index > newLength)
deleteProperty(exec, name);
}
}
length = newLength;
}