本文整理汇总了C++中set_type::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ set_type::clear方法的具体用法?C++ set_type::clear怎么用?C++ set_type::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类set_type
的用法示例。
在下文中一共展示了set_type::clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_node
int check_node(int x, int y, int z, MapData * map, int destroy)
{
if (nodes == NULL) {
nodes = (Position*)malloc(sizeof(Position) * NODE_RESERVE_SIZE);
nodes_size = NODE_RESERVE_SIZE;
}
node_pos = 0;
push_back_node(x, y, z);
while (node_pos > 0) {
if (node_pos >= nodes_size - 6) {
nodes_size += NODE_RESERVE_SIZE;
nodes = (Position*)realloc((void*)nodes,
sizeof(Position) * nodes_size);
}
const Position * current_node = pop_back_node();
z = current_node->z;
if (z >= 62) {
marked.clear();
return 1;
}
x = current_node->x;
y = current_node->y;
int i = get_pos(x, y, z);
// already visited?
pair<set_type<int>::iterator, bool> ret;
ret = marked.insert(i);
if (ret.second) {
add_node(x, y, z - 1, map);
add_node(x, y - 1, z, map);
add_node(x, y + 1, z, map);
add_node(x - 1, y, z, map);
add_node(x + 1, y, z, map);
add_node(x, y, z + 1, map);
}
}
// destroy the node's path!
if (destroy) {
for (set_type<int>::const_iterator iter = marked.begin();
iter != marked.end(); ++iter)
{
map->geometry[*iter] = 0;
map->colors.erase(*iter);
}
}
marked.clear();
return 0;
}
示例2: enableUpdates
inline void ObservableSettings::enableUpdates() {
boost::lock_guard<boost::mutex> lock(mutex_);
// if there are outstanding deferred updates, do the notification
updatesType_ = UpdatesEnabled;
if (deferredObservers_.size()) {
bool successful = true;
std::string errMsg;
for (iterator i=deferredObservers_.begin();
i!=deferredObservers_.end(); ++i) {
try {
const ext::shared_ptr<Observer::Proxy> proxy = i->lock();
if (proxy)
proxy->update();
} catch (std::exception& e) {
successful = false;
errMsg = e.what();
} catch (...) {
successful = false;
}
}
deferredObservers_.clear();
QL_ENSURE(successful,
"could not notify one or more observers: " << errMsg);
}
}
示例3: unregisterWithAll
inline void Observer::unregisterWithAll() {
boost::lock_guard<boost::recursive_mutex> lock(mutex_);
for (iterator i=observables_.begin(); i!=observables_.end(); ++i)
(*i)->unregisterObserver(proxy_);
observables_.clear();
}
示例4: clear
//-----------------------------------------------------------------//
void clear() {
erase_set_.clear();
current_ = start_;
}
示例5: clear
//-----------------------------------------------------------------//
void clear() {
erase_set_.clear();
array_.clear();
if(zero_handle_enable_) array_.push_back(T());
}