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

C++ rbegin函数代码示例

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

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



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

示例1: reservations_in_interval

void PipeLine::cancel_last_packet_reservation(std::shared_ptr<Frame> frame)
{
    auto slack = frame->slack_interval();
    auto interval_res = reservations_in_interval(slack);
    auto result = std::find_if(interval_res.rbegin(), interval_res.rend(), [frame](const pipeline_datatype& pair) -> bool {return frame == pair.second;} );
    cancel_reservation(slack.second - 1 - std::distance(interval_res.rbegin(), result));
}
开发者ID:ricsi-es-a-spancik,项目名称:IPM-08irSZORG,代码行数:7,代码来源:pipeline.cpp


示例2: QcBuffer

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//! return list of qcParameters for the last n seconds in buffer
const QcBuffer* QcBuffer::qcParameter(const Core::TimeSpan& lastNSeconds) const {

	QcBuffer* qcb = new QcBuffer();
	
	if (empty()) return qcb;

	const_reverse_iterator Start = rbegin();
	const_reverse_iterator End = rbegin();

	for (const_reverse_iterator qcPar = rbegin(); qcPar != rend(); qcPar++) {
		
		if (!(*qcPar)) continue;
		
		Core::TimeSpan diff = back()->recordEndTime - (*qcPar)->recordEndTime;
		
		Start = qcPar;

		if ( diff > lastNSeconds )
			break;
		
	}
	

	if (Start != End) {
		qcb->insert(qcb->begin(), End, Start);
		qcb->reverse();
	}

	return qcb;
}
开发者ID:Fran89,项目名称:seiscomp3,代码行数:32,代码来源:qcbuffer.cpp


示例3: getNewsFeed

 /** Retrieve the 10 most recent tweet ids in the user's news feed. Each item in the news feed must be posted by users who the user followed or by the user herself. Tweets must be ordered from most recent to least recent. */
 std::vector<int> getNewsFeed(int u) {
   std::vector<int> rslt;
   auto feeds = m_tweets[u];
   for (auto rit = feeds.rbegin();
        rit != feeds.rend() && rit - feeds.rbegin() < 10;
        ++rit) {
     rslt.push_back(rit->first);
   }
   return rslt;
 }
开发者ID:iamslash,项目名称:learn_to_code,代码行数:11,代码来源:a.cpp


示例4: lowestCommonAncestor

TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q)
{
    auto pathToP = pathToElem(root, p);
    auto pathToQ = pathToElem(root, q);
    size_t i = 0;
    for (i = 0; i != std::min(pathToQ.size(), pathToP.size()); i++)
    {
        if (*(pathToQ.rbegin() + i) != *(pathToP.rbegin() + i)) break;
    }
    return *(pathToQ.rbegin() + i - 1);
}
开发者ID:robling,项目名称:Leetcode,代码行数:11,代码来源:program.cpp


示例5: TEST

TEST(WordCountOpenMPTest, FileParAndSeqTest)
{
    pair<const char*, size_t> text = loadTextFromFile("book.txt");

    auto counted1 = countWords(text.first, text.second);
    auto flipped1 = flipMap<string, int>(counted1);

    auto counted2 = countWordsOpenMP(text.first, text.second, defaultThreadCount);
    auto flipped2 = flipMap<string, int>(counted2);

    ASSERT_TRUE(std::equal(flipped1.rbegin(), flipped1.rend(), flipped2.rbegin()));
}
开发者ID:h31,项目名称:ParallelComputing,代码行数:12,代码来源:test.cpp


示例6: rend

PresentationOrderSampleMap::iterator_range PresentationOrderSampleMap::findSamplesWithinPresentationRangeFromEnd(const MediaTime& beginTime, const MediaTime& endTime)
{
    reverse_iterator rangeEnd = std::find_if(rbegin(), rend(), [&beginTime] (PresentationOrderSampleMap::MapType::value_type value) {
        return value.second->presentationTime() <= beginTime;
    });

    reverse_iterator rangeStart = std::find_if(rbegin(), rangeEnd, [&endTime] (PresentationOrderSampleMap::MapType::value_type value) {
        return value.second->presentationTime() <= endTime;
    });

    return iterator_range(rangeEnd.base(), rangeStart.base());
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:12,代码来源:SampleMap.cpp


示例7: GetLength

 position_type   GetLength (void) const
 {
    if(! m_vRanges.empty())  {
         position_type From = begin()->GetFrom();
         return rbegin()->GetToOpen() - From;
    } else return 0;
 }
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:7,代码来源:range_coll.hpp


示例8: find

CItem* CItemList::find(const QPoint& pos) const/*{{{*/
{
	rciCItem ius;
	bool usfound = false;
	for (rciCItem i = rbegin(); i != rend(); ++i)
	{
		if (i->second->contains(pos))
		{
			if (i->second->isSelected())
				return i->second;

			else
			{
				if (!usfound)
				{
					ius = i;
					usfound = true;
				}
			}
		}
	}
	if (usfound)
		return ius->second;
	else
		return 0;
}/*}}}*/
开发者ID:Adamiko,项目名称:los,代码行数:26,代码来源:citem.cpp


示例9: foldr

inline T foldr(Cont&& cont, BinaryFunc&& func, T starting) {
    auto first = rbegin(std::forward<Cont>(cont));
    auto last = rend(std::forward<Cont>(cont));
    for(; first != last; ++first)
        starting = func(*first, starting);
    return starting;
}
开发者ID:Rapptz,项目名称:Lia,代码行数:7,代码来源:folds.hpp


示例10: getCandidateTree

CandidateSet::iterator CandidateSet::getCandidateTree(string topology) {
    for (CandidateSet::reverse_iterator rit = rbegin(); rit != rend(); rit++) {
        if (rit->second.topology == topology)
            return --(rit.base());
    }
    return end();
}
开发者ID:Cibiv,项目名称:IQ-TREE,代码行数:7,代码来源:candidateset.cpp


示例11: findGameObjects

void Scene::cleanup()
{
	auto toBeDestroyed = findGameObjects([](GameObject & go){return (go.toBeDestroyed_ == true);});
	for(auto it = toBeDestroyed.rbegin(); it != toBeDestroyed.rend(); it++)
	{
		auto* go = *it;
		go->setParent(nullptr);
		auto rootIt = std::find(root_->children_.begin(), root_->children_.end(), go);
		auto gameObjectsIt = std::find(gameObjects_.begin(), gameObjects_.end(), go);

		//the scene graph must contain this object
		assert(rootIt != root_->children_.end());

		//the list of all gameobjects must contain this object
		assert(gameObjectsIt != gameObjects_.end());

		//remove from scene graph
		root_->children_.erase(rootIt);

		//remove from all gameobjects
		gameObjects_.erase(gameObjectsIt);
		delete go;

	}
}
开发者ID:Swahhillie,项目名称:AStarCpp,代码行数:25,代码来源:Scene.cpp


示例12: GetColor

rColor rGradient::GetColor(float where) {
#ifndef DEDICATED
    if(empty()) return rColor();
    if(begin()->first >= where) return begin()->second;
    iterator upper, lower;
    iterator i=begin();
    iterator j=begin();
    ++j;
    bool finished = false;
    for(; j!=end(); ++i, ++j) {
        if(j->first >= where) {
            lower = i;
            upper = j;
            finished = true;
            break;
        }
    }
    if (!finished) return rbegin()->second;
    float diff = upper->first - lower->first;
    float pos = where - lower->first;
    rColor &c1 = lower->second;
    rColor &c2 = upper->second;
    float r = c1.r_*(diff-pos)/diff + c2.r_*pos/diff;
    float g = c1.g_*(diff-pos)/diff + c2.g_*pos/diff;
    float b = c1.b_*(diff-pos)/diff + c2.b_*pos/diff;
    float a = c1.a_*(diff-pos)/diff + c2.a_*pos/diff;
    return rColor(r,g,b,a);
#else
    return rColor(0.,0.,0.,0.);
#endif
}
开发者ID:KnIfER,项目名称:armagetron,代码行数:31,代码来源:rGradient.cpp


示例13: testReadUntil

inline void testReadUntil(const char* format)
{
    TemporaryData data{format};

    brion::SpikeReport reportWrite(brion::URI(data.tmpFileName),
                                   brion::MODE_WRITE);
    reportWrite.write(data.spikes);
    reportWrite.close();

    brion::SpikeReport reportRead(brion::URI(data.tmpFileName),
                                  brion::MODE_READ);

    auto spikes = reportRead.readUntil(0.15).get();
    BOOST_CHECK_EQUAL(spikes.size(), 1);
    BOOST_CHECK(reportRead.getCurrentTime() >= 0.15f);

    spikes = reportRead.readUntil(0.3).get();
    BOOST_CHECK_EQUAL(spikes.size(), 2);
    BOOST_CHECK(reportRead.getCurrentTime() >= 0.3f);
    BOOST_CHECK(spikes.rbegin()->first < 0.3);
    BOOST_CHECK_EQUAL(reportRead.getState(), brion::SpikeReport::State::ok);

    spikes = reportRead.read(brion::UNDEFINED_TIMESTAMP).get();
    BOOST_CHECK_EQUAL(spikes.size(), 2);
    BOOST_CHECK_EQUAL(reportRead.getCurrentTime(), brion::UNDEFINED_TIMESTAMP);
    BOOST_CHECK_EQUAL(reportRead.getState(), brion::SpikeReport::State::ended);
}
开发者ID:chevtche,项目名称:Brion,代码行数:27,代码来源:spikeReport.cpp


示例14: _transpose

            types::ndarray<T,N> _transpose(types::ndarray<T,N> const & a, long const l[N])
            {
                auto shape = a.shape;
                types::array<long, N> shp;
                for(unsigned long i=0; i<N; ++i)
                    shp[i] = shape[l[i]];

                types::ndarray<T,N> new_array(shp, __builtin__::None);

                types::array<long, N> new_strides;
                new_strides[N-1] = 1;
                std::transform(new_strides.rbegin(), new_strides.rend() -1, shp.rbegin(), new_strides.rbegin() + 1, std::multiplies<long>());

                types::array<long, N> old_strides;
                old_strides[N-1] = 1;
                std::transform(old_strides.rbegin(), old_strides.rend() -1, shape.rbegin(), old_strides.rbegin() + 1, std::multiplies<long>());

                auto iter = a.buffer,
                     iter_end = a.buffer + a.size();
                for(long i=0; iter!=iter_end; ++iter, ++i) {
                    long offset = 0;
                    for(unsigned long s=0; s<N; s++)
                        offset += ((i/old_strides[l[s]]) % shape[l[s]])*new_strides[s];
                    new_array.buffer[offset] = *iter;
                }

                return new_array;
            }
开发者ID:OnlySang,项目名称:pythran,代码行数:28,代码来源:transpose.hpp


示例15: getTile

std::vector<CreaturePtr> Map::getSpectatorsInRangeEx(const Position& centerPos, bool multiFloor, int minXRange, int maxXRange, int minYRange, int maxYRange)
{
    int minZRange = 0;
    int maxZRange = 0;
    std::vector<CreaturePtr> creatures;

    if(multiFloor) {
        minZRange = 0;
        maxZRange = Otc::MAX_Z;
    }

    //TODO: optimize
    //TODO: get creatures from other floors corretly
    //TODO: delivery creatures in distance order

    for(int iz=-minZRange; iz<=maxZRange; ++iz) {
        for(int iy=-minYRange; iy<=maxYRange; ++iy) {
            for(int ix=-minXRange; ix<=maxXRange; ++ix) {
                TilePtr tile = getTile(centerPos.translated(ix,iy,iz));
                if(!tile)
                    continue;

                auto tileCreatures = tile->getCreatures();
                creatures.insert(creatures.end(), tileCreatures.rbegin(), tileCreatures.rend());
            }
        }
    }

    return creatures;
}
开发者ID:Xileck,项目名称:otclient,代码行数:30,代码来源:map.cpp


示例16: rfind

 const_reverse_iterator rfind(value_type const& v) const
 {
     const_reverse_iterator i(std::upper_bound(rbegin(), rend(), v,
             compose_binary(std::logical_not<bool>(),
                 static_cast<TweakOrdering_ const&>(ord_))));
     return i != rend() && *i == v ? i: rend();
 }
开发者ID:YetAnotherTomek,项目名称:egfrd,代码行数:7,代码来源:sorted_list.hpp


示例17: rbegin

uint32 RangeSet::getLast() const
{
	const_reverse_iterator it = rbegin();
	if (it == rend())
		return RangeSetAbsent;
	return upper(it);
}
开发者ID:Criptomonedas,项目名称:rippled,代码行数:7,代码来源:RangeSet.cpp


示例18: int

void
TileImportanceTable::buildMatrix()
{

   if ( empty() ) {
      return;
   }
   
   int nbrDetailLevels = int((*rbegin()).second.getDetailLevel()) + 1;

   m_importanceMatrix.resize( nbrDetailLevels );
   for ( int i = 0; i < nbrDetailLevels; ++i ) {

      int nbrImportances = getNbrImportanceNbrs( 0, i );
      
      
      std::vector<const TileImportanceNotice*>* vecPtr = 
         new std::vector<const TileImportanceNotice*>();

      vecPtr->resize( nbrImportances );

      m_importanceMatrix[ i ] = vecPtr;
      for ( int j = 0; j < nbrImportances; ++j ) {
         // Use the slow method.
         (*vecPtr)[ j ] = getImportanceNbrSlow( j, i ); 
      }
   }
}
开发者ID:VLjs,项目名称:Wayfinder-S60-Navigator,代码行数:28,代码来源:TileImportanceTable.cpp


示例19: foldstring

void Messages::display_messages(WINDOW *const ipk_target, int const left, int const top,
                                int const right, int const bottom)
{
    if (!size()) {
        return;
    }
    
    int const maxlength = right - left;
    int line = bottom;

    for (int i = size() - 1; i >= 0; --i) {
        if (line < top) {
            break;
        }

        const game_message &m = player_messages.impl_->messages[i];
        const nc_color col = m.get_color(player_messages.impl_->curmes);

        const auto folded_strings = foldstring(m.get_with_count(), maxlength);
        const auto folded_rend = folded_strings.rend();
        for( auto string_iter = folded_strings.rbegin();
             string_iter != folded_rend && line >= top; ++string_iter, line-- ) {
            mvwprintz(ipk_target, line, left, col, "%s", string_iter->c_str());
        }
    }

    player_messages.impl_->curmes = calendar::turn.get_turn();
}
开发者ID:Catacstone,项目名称:Cataclysm-DDA,代码行数:28,代码来源:messages.cpp


示例20: getProcArgs

std::vector<std::string> getProcArgs(int pid, size_t argmax) {
  auto raw_args = getProcRawArgs(pid, argmax);
  std::vector<std::string> args;
  bool collect = false;

  // Iterate from the back until we stop seeing environment vars
  // Then start pushing args (in reverse order) onto a vector.
  // We trim the args of leading/trailing whitespace to make
  // analysis easier.
  for (auto itr = raw_args.rbegin(); itr < raw_args.rend(); ++itr) {
    if (collect) {
      std::string arg = *itr;
      boost::algorithm::trim(arg);
      args.push_back(arg);
    } else {
      size_t idx = itr->find_first_of("=");
      if (idx == std::string::npos) {
        collect = true;
      }
    }
  }

  // We pushed them on backwards, so we need to fix that.
  std::reverse(args.begin(), args.end());

  return args;
}
开发者ID:lovejavaee,项目名称:osquery,代码行数:27,代码来源:processes.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ rbtree_create函数代码示例发布时间:2022-05-30
下一篇:
C++ rb_yield_values函数代码示例发布时间: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