• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Iterator函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Iterator函数的典型用法代码示例。如果您正苦于以下问题:C++ Iterator函数的具体用法?C++ Iterator怎么用?C++ Iterator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Base_Timer_Queue

ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK, TIME_POLICY>::ACE_Timer_List_T (FUNCTOR* uf,
                    FreeList* fl,
                    TIME_POLICY const & time_policy)
  : Base_Timer_Queue (uf, fl, time_policy)
  , head_ (new ACE_Timer_Node_T<TYPE>)
  , id_counter_ (0)
{
  ACE_TRACE ("ACE_Timer_List_T::ACE_Timer_List_T");

  this->head_->set_next (this->head_);
  this->head_->set_prev (this->head_);

  ACE_NEW (iterator_, Iterator(*this));
}
开发者ID:Arkania,项目名称:ArkCORE-NG,代码行数:14,代码来源:Timer_List_T.cpp


示例2: Find

	//non constant version of find
  Iterator Find(const T& value)
  {
    uint32_t hidx=getIndex(&value);
    Node** nodePtr=&hash[hidx];
    if(!*nodePtr)return Iterator(0);
    if(TRAITS::isEqual((*nodePtr),&value))
    {
      return Iterator(this,hidx,*nodePtr,nodePtr);
    }
    Node** parentPtr=nodePtr;
    Node* node=(Node*)(*nodePtr)->ihsNextNode;
    while(node)
    {
      if(TRAITS::isEqual(node,&value))
      {
        return Iterator(this,hidx,node,parentPtr);
      }
      parentPtr=nodePtr;
      nodePtr=(Node**)&node->ihsNextNode;
      node=(Node*)node->ihsNextNode;
    }
    return Iterator(0);
  }
开发者ID:QC-git,项目名称:MyLab,代码行数:24,代码来源:IntrHashSet.hpp


示例3: make_filter_iterator

  filter_iterator<Predicate,Iterator>
  make_filter_iterator(
      typename iterators::enable_if<
          is_class<Predicate>
        , Iterator
      >::type x
    , Iterator end = Iterator()
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
    , Predicate* = 0
#endif 
  )
  {
      return filter_iterator<Predicate,Iterator>(x,end);
  }
开发者ID:00liujj,项目名称:dealii,代码行数:14,代码来源:filter_iterator.hpp


示例4: UpdateTimedCallbacks

// Updates the timed callback functions
void _Scripting::UpdateTimedCallbacks() {

	for(std::list<TimedCallbackStruct>::iterator Iterator(TimedCallbacks.begin()); Iterator != TimedCallbacks.end(); ++Iterator) {
		if(PlayState.GetTimer() >= (*Iterator).TimeStamp) {
			Scripting.CallFunction((*Iterator).Function);

			// Remove callback
			Iterator = TimedCallbacks.erase(Iterator);
			if(Iterator == TimedCallbacks.end())
				break;
		}
		else
			return;
	}
}
开发者ID:vinjn,项目名称:irrlamb,代码行数:16,代码来源:scripting.cpp


示例5: token_

XmlReader::XmlReader(std::string const& filepath) :
    token_(token_none), is_empty_element(false)
  {
  std::ifstream stream(filepath, std::ios::binary);
  if (!stream)
    {
    throw std::runtime_error("cannot open file " + filepath);
    }
  stream.unsetf(std::ios::skipws);
  stream.seekg(0, std::ios::end);
  std::size_t size = static_cast<std::size_t>(stream.tellg());
  stream.seekg(0);
  buffer.resize(size + 1);
  cursor = marker = Iterator(buffer.begin());
  stream.read(&buffer[0], static_cast<std::streamsize>(size));
  buffer[size] = 0;
  }
开发者ID:purpleKarrot,项目名称:Karrot,代码行数:17,代码来源:xml_reader.cpp


示例6: test

void test() {
	NodePtr hello = new Leaf("hello");
	NodePtr world = new Leaf("world");
	//check_node(hello);
	NodePtr hw = hello->concat_with(world);
	//hw->debug_print();
	check_node(hw);

	//concatenation
	for (int i = 0; i<100; i++) {
		if (i%20 == 0)
			std::cout<<i<<std::endl;
		hw = hw->concat_with(hello);
		//hw->debug_print();
		assert(check_node(hw));
	}
	assert(check_node(hw));
	hw->debug_print();

	//random access
	for (int i = 0; i<100; i++) {
		Iterator iter = Iterator(hw);
		int pos = 0;
		std::string s = hw->as_string();
		while (pos < hw->length()) {
			//std::cout<<pos<<" ";
			assert(s[pos] == iter.current());
			int d = rand()%100;
			pos += d;
			iter.advance(d);
		}
		assert(!iter.valid);
		//std::cout<<std::endl;
	}

	//slices
	for (int i = 0; i<100; i++) {
		int begin = rand()%(hw->length()+1);
		int end = begin+rand()%(hw->length()-begin+1);
		NodePtr slice = hw->slice(begin, end);
		assert(check_node(slice));
		std::cout<<begin<<" "<<end<<std::endl;
	}
	std::cout<<"hw depth "<<hw->depth()<<std::endl;
}
开发者ID:Vlad-Shcherbina,项目名称:Morph-Endo-Legacy,代码行数:45,代码来源:treap_rope.cpp


示例7: getTwiddleFactors

namespace sfft { namespace detail
{
  template<typename T>
  std::vector<std::complex<T> > getTwiddleFactors(size_t N, bool fwd,
    size_t Lm1Qm1 = std::numeric_limits<size_t>::max)
  {
    std::vector<std::complex<T> > factors(std::min(N, Lm1Qm1));
    if(factors.size() > 0)
    {
      factors[0] = 1;
      if(factors.size() > 1)
      {
        // Use high-precision multiplication of phasors.
        typedef std::complex<long double> HighPrecComplex;
        long double phase = 2*3.14159265358979323846/N;
        HighPrecComplex phasor(cos(phase), fwd ? -sin(phase) : sin(phase));
        HighPrecComplex tmp(phasor);
        factors[1] = tmp;
        for(size_t i = 2; i < factors.size(); ++i)
          factors[i] = tmp = tmp * phasor;
      }
    }
    return factors;
  }
} // namespace detail

template<typename Iterator>
using DereferencedType = typename std::remove_reference<decltype(*(Iterator()))>::type;

template<typename T>
struct Twiddler
{
  Twiddler(size_t N_, bool fwd,
    size_t Lm1Qm1 = std::numeric_limits<size_t>::max())
    :factors(detail::getTwiddleFactors<T>(N_, fwd, Lm1Qm1)),
    N(N_) {}

  const std::vector<std::complex<T> > factors;
  const size_t N;
};

} //namespace sfft
开发者ID:corybrinck,项目名称:sfft,代码行数:42,代码来源:twiddler.hpp


示例8: mapping_iterator

namespace maxwell {


/// \needsdoc
template<class Iterator, class Mapping>
class mapping_iterator : public Iterator {
public:
	typedef mapping_iterator self;
	typedef Iterator iterator_type;
	typedef Mapping mapping_type;
	typedef typename Mapping::result_type result_type;

	explicit mapping_iterator(Mapping m): mapping(m) {}
	explicit mapping_iterator(Iterator it): Iterator(it) {}
	mapping_iterator(Iterator it, Mapping m): Iterator(it), mapping(m) {}

	result_type operator*() const { return mapping(Iterator::operator*()); }
	result_type operator->() const { return mapping(Iterator::operator->()); }

private:
	mapping_type mapping;
};


/// \needsdoc
template<class T>
struct dereference {
	typedef T argument_type;
	typedef decltype(*T(nullptr)) result_type;

	result_type operator() (T const& x) const { return *x; }
};


/// \needsdoc
template<class Iterator>
using dereferencing_iterator = mapping_iterator<Iterator, dereference<
	typename std::remove_reference<decltype(*Iterator())>::type>
>;


} // namespace maxwell
开发者ID:fabianschuiki,项目名称:Maxwell,代码行数:42,代码来源:iterator.hpp


示例9: erase_after

  Iterator  erase_after(const Iterator&  it)
  {
    auto  target = it.ptr->next               ;
                   it.ptr->next = target->next;

      if(last == target)
      {
        last = target->next;

          if(last == nullptr)
          {
            first = nullptr;
          }
      }


    delete target;

    return Iterator(it.ptr->next);
  }
开发者ID:mugisaku,项目名称:libmkf,代码行数:20,代码来源:mkf_list.hpp


示例10: main

int main(int, char* [] )
{
    typedef itk::Image<unsigned char, 2> ImageType;
    ImageType::Pointer image = ImageType::New();

    itk::Index<2> corner = {{0,0}};
    itk::Size<2> size = {{10,10}};
    itk::ImageRegion<2> region(corner,size);
    image->SetRegions(region);
    image->Allocate();

    unsigned int counter = 0; // To make sure the loop isn't optimized away
    for(unsigned int i = 0; i < 1e7; ++i)
    {
        counter += Iterator(image.GetPointer()); // about 7.2 seconds
//    counter += IteratorWithIndex(image.GetPointer()); // about 2.6 seconds
    }

    std::cout << "counter " << counter << std::endl; // To make sure the loop isn't optimized away
    return 0;
}
开发者ID:daviddoria,项目名称:ITKTimingDemos,代码行数:21,代码来源:IteratorWithIndex.cpp


示例11: find

			Iterator find(const Key_T &key) 
			{ 
				Node* current_node;
				Node* fallback_node = levels;

				for(int i = (MaxLevel - 1); i >= 0; i--)
				{
					current_node = fallback_node;
					while(current_node != NULL)
					{
						fallback_node = current_node;
						if(current_node->nodes[i] == NULL || current_node->nodes[i]->dataPair.first > key)
							break; // Next string on this node
						else if (current_node->nodes[i]->dataPair.first == key)
							return Iterator(current_node->nodes[i]);
						else if(current_node->nodes[i]->dataPair.first < key)
							current_node = current_node->nodes[i];
					}
				}
				return NULL;
			}
开发者ID:petersbattaglia,项目名称:Skip_List,代码行数:21,代码来源:SkipList.hpp


示例12: find_next_node_breadth

void SceneGraph::Iterator::
find_next_node_breadth() {

    if (breadth_nodes_.empty()) {
        Iterator end;
        for (Iterator it(start_node_); it != end; ++it)
            breadth_nodes_[it.get_depth()].push_back(it.current_node_);
    }

    auto end(breadth_nodes_[current_depth_].end());
    for (auto node(breadth_nodes_[current_depth_].begin());
              node != end; ++node) {

        if (*node == current_node_) {
            if (++node != end) {
                current_node_ = *node;
            } else if (++current_depth_ < breadth_nodes_.size()) {
                current_node_ = breadth_nodes_[current_depth_].front();
            } else *this = Iterator();
            break;
        }
    }
}
开发者ID:thelaui,项目名称:guacamole-attic,代码行数:23,代码来源:Iterator.cpp


示例13: begin

 Iterator begin() const { 
   return Iterator(*this); 
 }
开发者ID:Alienfeel,项目名称:graphlab,代码行数:3,代码来源:discrete_domain.hpp


示例14: end

		Iterator end()
		{
			return Iterator(0);
		}
开发者ID:Zoxc,项目名称:Prelude,代码行数:4,代码来源:LinkedList.hpp


示例15: begin

		Iterator begin()
		{
			return Iterator(first);
		}
开发者ID:Zoxc,项目名称:Prelude,代码行数:4,代码来源:LinkedList.hpp


示例16: end

 Iterator end() const { return Iterator(_offset+_size); }
开发者ID:CCJY,项目名称:coliru,代码行数:1,代码来源:main.cpp


示例17: assert

DBCFile::Iterator DBCFile::end()
{
    assert(data);
    return Iterator(*this, stringTable);
}
开发者ID:kmishima,项目名称:DarkCore,代码行数:5,代码来源:DBCFile.cpp


示例18: end

 Iterator end() const {
     return Iterator(
             this->container.end(),
             this->container.end(),
             this->filter_func);
 }
开发者ID:n00btime,项目名称:cppitertools,代码行数:6,代码来源:filter.hpp


示例19: make_filter_iterator

inline filter_iterator<Predicate,Iterator>
make_filter_iterator(Predicate f, Iterator x, Iterator end = Iterator())
{
    return filter_iterator<Predicate,Iterator>(f,x,end);
}
开发者ID:marops,项目名称:PDAL,代码行数:5,代码来源:filter_iterator.hpp


示例20: token_iterator

 token_iterator(Iterator begin, Iterator e = Iterator())
     : f_(),begin_(begin),end_(e),valid_(false),tok_() {
     initialize();
 }
开发者ID:basho-labs,项目名称:riak-cxx-client,代码行数:4,代码来源:token_iterator.hpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Ith函数代码示例发布时间:2022-05-30
下一篇:
C++ Iterate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap