本文整理汇总了C++中LinkViewRef::is_attached方法的典型用法代码示例。如果您正苦于以下问题:C++ LinkViewRef::is_attached方法的具体用法?C++ LinkViewRef::is_attached怎么用?C++ LinkViewRef::is_attached使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkViewRef
的用法示例。
在下文中一共展示了LinkViewRef::is_attached方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validate
void validate(CollectionChangeSet const& info)
{
info.insertions.verify();
info.deletions.verify();
info.modifications.verify();
std::vector<size_t> move_sources;
for (auto const& move : info.moves)
move_sources.push_back(m_initial[move.from]);
// Apply the changes from the transaction log to our copy of the
// initial, using UITableView's batching rules (i.e. delete, then
// insert, then update)
auto it = util::make_reverse_iterator(info.deletions.end());
auto end = util::make_reverse_iterator(info.deletions.begin());
for (; it != end; ++it) {
m_initial.erase(m_initial.begin() + it->first, m_initial.begin() + it->second);
}
for (auto const& range : info.insertions) {
for (auto i = range.first; i < range.second; ++i)
m_initial.insert(m_initial.begin() + i, m_linkview->get(i).get_int(0));
}
for (auto const& range : info.modifications) {
for (auto i = range.first; i < range.second; ++i)
m_initial[i] = m_linkview->get(i).get_int(0);
}
REQUIRE(m_linkview->is_attached());
// and make sure we end up with the same end result
REQUIRE(m_initial.size() == m_linkview->size());
for (size_t i = 0; i < m_initial.size(); ++i)
CHECK(m_initial[i] == m_linkview->get(i).get_int(0));
// Verify that everything marked as a move actually is one
for (size_t i = 0; i < move_sources.size(); ++i) {
if (!info.modifications.contains(info.moves[i].to)) {
CHECK(m_linkview->get(info.moves[i].to).get_int(0) == move_sources[i]);
}
}
}