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


C++ rend函数代码示例

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


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

示例1: rend

PresentationOrderSampleMap::reverse_iterator PresentationOrderSampleMap::reverseFindSampleContainingPresentationTime(const MediaTime& time)
{
    auto range = std::equal_range(rbegin(), rend(), time, SampleIsGreaterThanMediaTimeComparator<MapType>());
    if (range.first == range.second)
        return rend();
    return range.first;
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:7,代码来源:SampleMap.cpp

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

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

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

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

示例6: rbegin

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

示例7: test_posix_dup

static void test_posix_dup() 
{ 
    int pfd[2]; 

    BOOST_REQUIRE(::pipe(pfd) != -1); 
    bpd::file_handle rend(pfd[0]); 
    bpd::file_handle wend(pfd[1]); 

    BOOST_REQUIRE(rend.get() != 10); 
    BOOST_REQUIRE(wend.get() != 10); 
    bpd::file_handle fh1 = bpd::file_handle::posix_dup(wend.get(), 10); 
    BOOST_REQUIRE_EQUAL(fh1.get(), 10); 

    BOOST_REQUIRE(::write(wend.get(), "test-posix-dup", 14) != -1); 
    char buf1[15]; 
    BOOST_REQUIRE_EQUAL(::read(rend.get(), buf1, sizeof(buf1)), 14); 
    buf1[14] = '\0'; 
    BOOST_REQUIRE(std::strcmp(buf1, "test-posix-dup") == 0); 

    BOOST_REQUIRE(::write(fh1.get(), "test-posix-dup", 14) != -1); 
    char buf2[15]; 
    BOOST_REQUIRE_EQUAL(::read(rend.get(), buf2, sizeof(buf2)), 14); 
    buf2[14] = '\0'; 
    BOOST_REQUIRE(std::strcmp(buf2, "test-posix-dup") == 0); 
} 
开发者ID:CovenantEyes,项目名称:boost-process,代码行数:25,代码来源:detail_file_handle_test.cpp

示例8: rstart

Match::Match(const char *start_of_array, size_t array_size, size_t match_start_offset, size_t match_end_offset, long long line_number)
{
	auto line_ending = "\n";
	// Find the start of the line.
	std::reverse_iterator<const char*> rstart(start_of_array+match_start_offset);
	std::reverse_iterator<const char*> rend(start_of_array);

	auto line_start_rit = std::find(rstart, rend, line_ending[0]);
	const char *line_start;
	if(line_start_rit == rend)
	{
		// The line has no starting '\n', so it must be the first line.
		line_start = start_of_array;
	}
	else
	{
		// The line had a starting '\n', clip it off.
		line_start = line_start_rit.base();
	}

	// Find the end of the matched line.
	auto line_end = std::find(start_of_array+match_start_offset, start_of_array+array_size, line_ending[0]);

	// Form the match substrings.
	m_pre_match = std::string(line_start, start_of_array+match_start_offset);
	m_match = std::string(start_of_array+match_start_offset, start_of_array+match_end_offset);
	m_post_match = std::string(start_of_array+match_start_offset+(match_end_offset-match_start_offset), line_end);
	m_line_number = line_number;
}
开发者ID:Ferada,项目名称:ucg,代码行数:29,代码来源:Match.cpp

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

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

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

DecodeOrderSampleMap::reverse_iterator DecodeOrderSampleMap::reverseFindSampleWithDecodeKey(const KeyType& key)
{
    DecodeOrderSampleMap::iterator found = findSampleWithDecodeKey(key);
    if (found == end())
        return rend();
    return --reverse_iterator(found);
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:7,代码来源:SampleMap.cpp

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

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

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


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