本文整理汇总了C++中boost::unordered_set::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_set::erase方法的具体用法?C++ unordered_set::erase怎么用?C++ unordered_set::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::unordered_set
的用法示例。
在下文中一共展示了unordered_set::erase方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACE
PNS_NODE::~PNS_NODE()
{
TRACE( 0, "PNS_NODE::delete %p", this );
if( !m_children.empty() )
{
TRACEn( 0, "attempting to free a node that has kids.\n" );
assert( false );
}
#ifdef DEBUG
if( allocNodes.find( this ) == allocNodes.end() )
{
TRACEn( 0, "attempting to free an already-free'd node.\n" );
assert( false );
}
allocNodes.erase( this );
#endif
for( PNS_INDEX::ITEM_SET::iterator i = m_index->begin(); i != m_index->end(); ++i )
{
if( (*i)->BelongsTo( this ) )
delete *i;
}
releaseGarbage();
unlinkParent();
delete m_index;
}
示例2: unregisterObserver
inline Size Observable::unregisterObserver(Observer* o) {
// in case the observer is in the deferred notifications list
// remove it
if (settings_.updatesDeferred())
settings_.unregisterDeferredObserver(o);
return observers_.erase(o);
}
示例3: deep_equals
bool WRLDRecord::deep_equals(Record *master, RecordOp &read_self, RecordOp &read_master, boost::unordered_set<Record *> &identical_records)
{
//Precondition: equals has been run for these records and returned true
// all child records have been visited
const WRLDRecord *master_wrld = (WRLDRecord *)master;
if(CELLS.size() > master_wrld->CELLS.size())
return false;
if(ROAD != NULL)
{
if(master_wrld->ROAD != NULL)
{
if(identical_records.count(ROAD) == 0)
return false;
}
else
return false;
}
if(CELL != NULL)
{
if(master_wrld->CELL != NULL)
{
if(identical_records.count(CELL) == 0)
return false;
}
else
return false;
}
for(uint32_t ListIndex = 0; ListIndex < CELLS.size(); ++ListIndex)
if(identical_records.count(CELLS[ListIndex]) == 0)
return false;
//The cell and all its contents are dupes, so remove the child records from identical_records
// This prevents Bash from trying to double delete records (first the cell, and later a child that was in the cell)
identical_records.erase(ROAD);
identical_records.erase(CELL);
for(uint32_t ListIndex = 0; ListIndex < CELLS.size(); ++ListIndex)
identical_records.erase(CELLS[ListIndex]);
return true;
}
示例4: sanity_checks
void sanity_checks() {
ASSERT_TRUE(cm.begin() == cm.end());
for (size_t i = 0;i < NINS; ++i) {
um.insert(17 * i);
}
graphlab::thread_group thrgroup;
for (size_t i = 0; i < 10; ++i) {
thrgroup.launch(boost::bind(parallel_inserter,
i * NINS/10,
(i + 1) * NINS / 10));
}
thrgroup.join();
std::cout << "Size: " << cm.size() << std::endl;
std::cout << "Capacity: " << cm.capacity() << std::endl;
std::cout << "Load Factor: " << cm.load_factor() << std::endl;
for (size_t i = 0;i < NINS; ++i) {
if (cm.get_sync(17 * i).first == false) {
std::cout << cm.count(17 * i) << "\n";
std::cout << "Failure on: " << 17 * i << std::endl;
assert(cm.get_sync(17 * i).first == true);
}
assert(um.count(17 * i) == 1);
}
assert(cm.size() == NINS);
assert(um.size() == NINS);
for (size_t i = 0;i < NINS; i+=2) {
um.erase(17*i);
}
for (size_t i = 0; i < 10; ++i) {
thrgroup.launch(boost::bind(parallel_erase,
i * NINS/10,
(i + 1) * NINS / 10));
}
thrgroup.join();
for (size_t i = 0;i < NINS; i+=2) {
assert(cm.get_sync(17*i).first == (bool)(i % 2));
assert(um.count(17*i) == i % 2);
}
assert(cm.size() == NINS / 2);
assert(um.size() == NINS / 2);
}
示例5: TRACEn
PNS_NODE::~PNS_NODE()
{
if( !m_children.empty() )
{
TRACEn( 0, "attempting to free a node that has kids.\n" );
assert( false );
}
if( allocNodes.find( this ) == allocNodes.end() )
{
TRACEn( 0, "attempting to free an already-free'd node.\n" );
assert( false );
}
allocNodes.erase( this );
for( PNS_INDEX::ItemSet::iterator i = m_index->begin();
i != m_index->end(); ++i )
if( (*i)->BelongsTo( this ) )
delete *i;
unlinkParent();
delete m_index;
}
示例6: unregisterObserver
inline Size Observable::unregisterObserver(Observer* o) {
if (settings_.updatesDeferred())
settings_.unregisterDeferredObserver(o);
return observers_.erase(o);
}
示例7: remove_live_object
void Object::remove_live_object(Object* o) {
IMP_INTERNAL_CHECK(live_.find(o) != live_.end(),
"Object " << o->get_name() << " not found in live list.");
live_.erase(o);
}
示例8: unregisterWith
inline
Size Observer::unregisterWith(const boost::shared_ptr<Observable>& h) {
if (h)
h->unregisterObserver(this);
return observables_.erase(h);
}
示例9: unregisterDeferredObserver
inline void ObservableSettings::unregisterDeferredObserver(Observer* o) {
QL_TRACE("removing observer " << o << " from the deferred list");
deferredObservers_.erase(o);
}