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


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

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


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

示例1: make_pair

  std::pair<iterator, bool>
  insert (const value_type& x) {

    if (x.first < x.second) {       
      if (empty ()) {
	return m_set.insert (x);
      }

      iterator pos = find_first_touch (x);
      if (pos == end ()) {
	//nothing intersects x
	return m_set.insert (x);
      }

      const Key alpha = std::min (x.first, pos->first);
      Key beta = pos->second;
      while (pos != m_set.end () && touch (*pos, x)) {
	beta = pos->second;
	m_set.erase (pos++);
      }

      beta = std::max (beta, x.second);
      return m_set.insert (std::make_pair (alpha, beta));
    }
    
    return std::make_pair (m_set.end (), false);
  }
开发者ID:jrwilson,项目名称:mftp,代码行数:27,代码来源:interval_set.hpp

示例2:

 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

示例3: erase

  size_type erase (const key_type& k) {
    if (k.first < k.second) {       
      if (empty ()) {
	return 0;
      }

      iterator pos = find_first_intersect (k);
      if (pos == end ()) {
	return 0;
      }

      const Key alpha = pos->first; 
      const Key beta = std::min (pos->second, k.first);
      Key delta = pos->second;

      size_type count = 0;
      while (pos != m_set.end () && intersect (*pos, k)) {
	delta = pos->second;
	m_set.erase (pos++);
	++count;
      }
      insert (std::make_pair (alpha, beta));
      insert (std::make_pair (k.second, delta));

      return count;
    }
    return 0;
  }
开发者ID:jrwilson,项目名称:mftp,代码行数:28,代码来源:interval_set.hpp

示例4: probe

		//-----------------------------------------------------------------//
		inline bool probe(handle_type h) const {
			if(static_cast<size_t>(h) < size()) {
				return erase_set_.find(h) == erase_set_.end();
			} else {
				return false;
			}
		}
开发者ID:hirakuni45,项目名称:glfw3_app,代码行数:8,代码来源:handle_set.hpp

示例5: 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

示例6: probe

		//-----------------------------------------------------------------//
		bool probe(handle_type h) const {
			if(h > 0 && h < limit_) {
				return erase_set_.find(h) == erase_set_.end();
			} else {
				return false;
			}
		}
开发者ID:hirakuni45,项目名称:glfw3_app,代码行数:8,代码来源:handle_set.hpp

示例7:

// Let an object un-register its existence
void
object_registrar::unregister_object_imp
(
    object_id  obj
)
{
    set_type::iterator const  i = db_.find( obj );

    if ( i != db_.end() )
    {
        db_.erase( i );

        #if CONTROL_EXTRA_PRINTING
        std::cout << "Unregistered " << obj << '.' << std::endl;
        #endif
    }
    else
    {
        overkilled_.push_back( obj );

        #if CONTROL_EXTRA_PRINTING
        std::cout << "Attempted to unregister a non-existant " << obj
         << '.' << std::endl;
        #endif
    }
}
开发者ID:Albermg7,项目名称:boost,代码行数:27,代码来源:base_from_member_test.cpp

示例8: 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

示例9: make_pair

 inline std::pair<Observer::iterator, bool>
 Observer::registerWith(const ext::shared_ptr<Observable>& h) {
     if (h) {
         h->registerObserver(this);
         return observables_.insert(h);
     }
     return std::make_pair(observables_.end(), false);
 }
开发者ID:SePTimO7,项目名称:QuantLib,代码行数:8,代码来源:observable.hpp

示例10: 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

示例11: 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

示例12: erase

		//-----------------------------------------------------------------//
		bool erase(handle_type h) {
			if(static_cast<size_t>(h) < size()) {
				set_it it = erase_set_.find(h);
				if(it == erase_set_.end()) {
					erase_set_.insert(h);
					return true;
				}
			}
			return false;
		}
开发者ID:hirakuni45,项目名称:glfw3_app,代码行数:11,代码来源:handle_set.hpp

示例13: erase

		//-----------------------------------------------------------------//
		bool erase(handle_type h) {
			if(h > 0 && h < limit_) {
				set_it it = erase_set_.find(h);
				if(it == erase_set_.end()) {
					erase_set_.insert(h);
					return true;
				}
			}
			return false;
		}
开发者ID:hirakuni45,项目名称:glfw3_app,代码行数:11,代码来源:handle_set.hpp

示例14: 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

示例15: 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


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