当前位置: 首页>>代码示例>>C++>>正文


C++ set_type::begin方法代码示例

本文整理汇总了C++中set_type::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ set_type::begin方法的具体用法?C++ set_type::begin怎么用?C++ set_type::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在set_type的用法示例。


在下文中一共展示了set_type::begin方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

 inline Observer& Observer::operator=(const Observer& o) {
     iterator i;
     for (i=observables_.begin(); i!=observables_.end(); ++i)
         (*i)->unregisterObserver(this);
     observables_ = o.observables_;
     for (i=observables_.begin(); i!=observables_.end(); ++i)
         (*i)->registerObserver(this);
     return *this;
 }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:9,代码来源:observable.hpp

示例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);
        }
    }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:30,代码来源:observable.hpp

示例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();
    }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:8,代码来源:observable.hpp

示例4: lock

    inline Observer::~Observer() {
        boost::lock_guard<boost::recursive_mutex> lock(mutex_);
        if (proxy_)
            proxy_->deactivate();

        for (iterator i=observables_.begin(); i!=observables_.end(); ++i)
            (*i)->unregisterObserver(proxy_);
    }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:8,代码来源:observable.hpp

示例5: Observer

    inline Observer::Observer(const Observer& o) {
        proxy_.reset(new Proxy(this));

        {
             boost::lock_guard<boost::recursive_mutex> lock(o.mutex_);
             observables_ = o.observables_;
        }

        for (iterator i=observables_.begin(); i!=observables_.end(); ++i)
            (*i)->registerObserver(proxy_);
    }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:11,代码来源:observable.hpp

示例6: 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;
}
开发者ID:Colorpinpoint,项目名称:pysnip,代码行数:54,代码来源:vxl_c.cpp

示例7: insert

		//-----------------------------------------------------------------//
		handle_type insert(const T& st) {
			handle_type h;
			if(erase_set_.empty()) {
				h = static_cast<handle_type>(array_.size());
				array_.push_back(st);
			} else {
				set_it it = erase_set_.begin();
				h = *it;
				array_[h] = st;
				erase_set_.erase(it);
			}
			return h;
		}
开发者ID:hirakuni45,项目名称:glfw3_app,代码行数:14,代码来源:handle_set.hpp

示例8: create

		//-----------------------------------------------------------------//
		handle_type create() {
			handle_type h;
			if(erase_set_.empty()) {
				if(current_ < limit_) {
					h = current_;
					++current_;
				} else {
					current_ = limit_ - 1;
					h = 0;
				}
			} else {
				set_it it = erase_set_.begin();
				h = *it;
				erase_set_.erase(it);
			}
			return h;
		}
开发者ID:hirakuni45,项目名称:glfw3_app,代码行数:18,代码来源:handle_set.hpp

示例9: powerset

powerset_type powerset(set_type const& set)
{
  typedef set_type::const_iterator set_iter;
  typedef std::vector<set_iter> vec;
  typedef vec::iterator vec_iter;

  struct local
  {
    static int dereference(set_iter v) { return *v; }
  };

  powerset_type result;

  vec elements;
  do
  {
    set_type tmp;
    std::transform(elements.begin(), elements.end(),
                   std::inserter(tmp, tmp.end()),
                   local::dereference);
    result.insert(tmp);
    if (!elements.empty() && ++elements.back() == set.end())
    {
      elements.pop_back();
    }
    else
    {
      set_iter iter;
      if (elements.empty())
      {
        iter = set.begin();
      }
      else
      {
        iter = elements.back();
        ++iter;
      }
      for (; iter != set.end(); ++iter)
      {
        elements.push_back(iter);
      }
    }
  } while (!elements.empty());

  return result;
}
开发者ID:Anatolt,项目名称:RosettaCodeData,代码行数:46,代码来源:power-set-1.cpp

示例10: begin

 iterator begin () const {
   return m_set.begin ();
 }
开发者ID:jrwilson,项目名称:mftp,代码行数:3,代码来源:interval_set.hpp

示例11: disjoint

 bool disjoint(const set_type& a, const set_type& b) {
     counting_output_iterator out;
     return std::set_intersection(a.begin(), a.end(),
                                  b.begin(), b.end(), out).count() == 0;
 }
开发者ID:chongbingbao,项目名称:libgm,代码行数:5,代码来源:set_index.cpp

示例12: printSet

void printSet(set_type s) {
    for (typename set_type::iterator p = s.begin(); p != s.end(); p++)
        cout << *p << ' ';
    cout << endl;
}
开发者ID:djkovrik,项目名称:eckel_cpp,代码行数:5,代码来源:ex06.cpp


注:本文中的set_type::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。