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


C++ rbegin函数代码示例

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


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


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