本文整理汇总了C++中ArrayData::currentRef方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayData::currentRef方法的具体用法?C++ ArrayData::currentRef怎么用?C++ ArrayData::currentRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayData
的用法示例。
在下文中一共展示了ArrayData::currentRef方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: advance
bool MutableArrayIter::advance() {
ArrayData *data = m_var ? getData() : m_data;
if (!data) return false;
// If the foreach loop's array changed since the previous iteration,
// we recover by creating a new strong iterator for the new array,
// starting with at the position indicated by the new array's internal
// pointer.
if (m_fp.container != data) {
// Free the current strong iterator if its valid
if (m_fp.container != NULL) {
m_fp.container->freeFullPos(m_fp);
}
assert(m_fp.container == NULL);
// If needed, escalate the array to an array type that can support
// foreach by reference
escalateCheck();
// Trigger COW if needed, copying over strong iterators
data = cowCheck();
// Create a new strong iterator for the new array
data->newFullPos(m_fp);
} else {
// Trigger COW if needed, copying over strong iterators
data = cowCheck();
}
assert(m_fp.container == data);
if (!data->setFullPos(m_fp)) return false;
CVarRef curr = data->currentRef();
m_valp->assignRef(curr);
if (m_key) m_key->assignVal(data->key());
data->next();
data->getFullPos(m_fp);
return true;
}
示例2: advance
bool MutableArrayIter::advance() {
ArrayData *data = m_var ? getData() : m_data;
if (!data) return false;
// If the foreach loop's array changed since the previous iteration,
// we recover by creating a new strong iterator for the new array,
// starting with at the position indicated by the new array's internal
// pointer.
if (m_fp.container != data) {
// Free the current strong iterator if its valid
if (m_fp.container != NULL) {
m_fp.container->freeFullPos(m_fp);
}
// Create a new strong iterator for the new array
ASSERT(m_fp.container == NULL);
data->newFullPos(m_fp);
}
ASSERT(m_fp.container == data);
if (!data->setFullPos(m_fp)) return false;
CVarRef curr = data->currentRef();
curr.setContagious();
m_val = curr;
if (m_key) *m_key = data->key();
data->next();
data->getFullPos(m_fp);
return true;
}
示例3: advance
bool MutableArrayIter::advance() {
ArrayData *data = getData();
if (!data) return false;
if (!data->setFullPos(m_pos)) return false;
CVarRef curr = data->currentRef();
curr.setContagious();
m_val = curr;
if (m_key) *m_key = data->key();
data->next();
data->getFullPos(m_pos);
return true;
}