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


C++ list::rend方法代码示例

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


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

示例1: top_tags

	bool top_tags(const char* str1, const char* str2)
	{
		std::list<std::string>::reverse_iterator i = tag_stack.rbegin();
		if (i == tag_stack.rend()) return false;
		if (!string_equal_nocase(i->c_str(), str2)) return false;
		++i;
		if (i == tag_stack.rend()) return false;
		if (!string_equal_nocase(i->c_str(), str1)) return false;
		return true;
	}
开发者ID:Krinkelss,项目名称:libtorrent,代码行数:10,代码来源:upnp.cpp

示例2: noise

gfx::Color PerlinCity::noise(const std::list<gfx::VolumeGray8Sptr> &op,
    const math::vec3d &tt)
{
  float ns = 0.0f,
        wt = 1.0f;

  for(std::list<gfx::VolumeGray8Sptr>::const_reverse_iterator ii = op.rbegin(), ee = op.rend();
      (ii != ee); ++ii)
  {
    gfx::VolumeGray8 *vv = ii->get();
    ns += wt * math::abs((vv->getAveragePixel(tt.x(), tt.y(), tt.z()) - 0.5f));
    wt *= 0.5f;
  }
  //ns = ns*ns;

  //ns = ns + 0.5f;
  if(ns < 0.0f)
  {
    ns = -ns;
  }
  else if(ns > 1.0f)
  {
    ns = 2.0f - ns;
  }

  return gfx::Color(ns, ns, ns);
  //return m_gradient.getColor(ns);
}
开发者ID:dtbinh,项目名称:faemiyah-demoscene_2010-08_gamedev_orbital_bombardment,代码行数:28,代码来源:ob_planet.cpp

示例3: leaveScope

void Variables::leaveScope(bool insideLoop)
{
    if (insideLoop) {
        // read variables are read again in subsequent run through loop
        std::set<unsigned int> const & currentVarReadInScope = _varReadInScope.back();
        for (std::set<unsigned int>::const_iterator readIter = currentVarReadInScope.begin();
             readIter != currentVarReadInScope.end();
             ++readIter) {
            read(*readIter, nullptr);
        }
    }

    std::list<std::set<unsigned int> >::reverse_iterator reverseReadIter = _varReadInScope.rbegin();
    ++reverseReadIter;
    if (reverseReadIter != _varReadInScope.rend()) {
        // Transfer read variables into previous scope

        std::set<unsigned int> const & currentVarAddedInScope = _varAddedInScope.back();
        std::set<unsigned int>  & currentVarReadInScope = _varReadInScope.back();
        for (std::set<unsigned int>::const_iterator addedIter = currentVarAddedInScope.begin();
             addedIter != currentVarAddedInScope.end();
             ++addedIter) {
            currentVarReadInScope.erase(*addedIter);
        }
        std::set<unsigned int> & previousVarReadInScope = *reverseReadIter;
        previousVarReadInScope.insert(currentVarReadInScope.begin(),
                                      currentVarReadInScope.end());
    }
    _varReadInScope.pop_back();
    _varAddedInScope.pop_back();
}
开发者ID:barisdemiray,项目名称:cppcheck,代码行数:31,代码来源:checkunusedvar.cpp

示例4: freeBlocks

	void HeapPage::freeBlocks(std::list<HeapBlock>& newBlocks, std::list<HeapBlock>& newReleasedBlocks) {
		// Copy new blocks.
		blocks = newBlocks;

		// Check if we can join some values.
		IntPtr pageHighAddress = reinterpret_cast<IntPtr>(&memory[pagepointer]);
		std::list<HeapBlock>::reverse_iterator current = newBlocks.rbegin();

		// Start looking from the end of new blocks.
		// Use the new blocks listing, not the instance list.
		while (current != newBlocks.rend() && current->isReleased()) {
			const IntPtr blockHighAddress = reinterpret_cast<IntPtr>(current->getHandle()) + current->getSize();

			// If both are pointing to the same memory location,
			// we can join this block with the free memory region
			// of the page.
			if (blockHighAddress == pageHighAddress) {
				// Compute new high address and move page 
				// pointer back.
				pageHighAddress -= current->getSize();
				pagepointer -= current->getSize();

				// Remove from new released block listing.
				newReleasedBlocks.remove(*current);
				blocks.remove(*current);

				current++;
			} else {
				// If we can't join the first block to the free memory region,
				// there is no point going trough other blocks.
				break;
			}
		}
	}
开发者ID:Babelz,项目名称:SaNi,代码行数:34,代码来源:heap_page.cpp

示例5: sortRegions

void Preprocessor::sortRegions (std::list<RegionIterator>& regions)
{
	for ( std::list<RegionIterator>::iterator i = regions.begin(); i != regions.end(); ++i )
	{
		if ( i == regions.begin() )
			continue;

		// Get current element
		RegionIterator value = *i;

		// Get previous element
		std::list<RegionIterator>::reverse_iterator j = regions.rbegin();
		advance(j, distance(i, regions.end()));

		// Shift elements until finding final position
		while ( j != regions.rend() && *value < *(*j) )
		{
			std::list<RegionIterator>::reverse_iterator k = j;
			--k;
			*k = *j;

			++j;
		}

		// Insert current element into its final position
		std::list<RegionIterator>::reverse_iterator k = j;
		--k;
		*k = value;
	}
};
开发者ID:elitalon,项目名称:nessie-ocr,代码行数:30,代码来源:Preprocessor.cpp

示例6:

void
test_ns::matrix::
find_one_puddle_and_update(int entry_h, const entry_pos_t& entry_pos,
        entry_pos_set_t& puddle_pos, entry_pos_set_t& leaks_pos,
        std::list<puddle>& puddles,
        size_t& yet_not_found_positions) const {
    entry_pos_set_t searched_entries;
    entry_pos_set_t below_level_entries;
    bool is_puddle = find_one_puddle(entry_h, entry_pos, leaks_pos,
            searched_entries, below_level_entries);
    yet_not_found_positions -= searched_entries.size();
    if (is_puddle) {
        for (const auto & e : searched_entries) {
            puddle_pos.insert(e);
        }
        if (!below_level_entries.empty()) {
            for (auto const & below_entry : below_level_entries) {
                for (auto i = puddles.rbegin(); i != puddles.rend(); ++i) {
                    const auto & puddle = *i;
                    auto & entries = puddle.entries_;
                    if (entries.find(below_entry) != entries.end()) {
                        puddles.erase(std::prev (i.base()));
                        break;
                    }
                }
            }
        }
        puddle a_puddle{searched_entries, entry_h};
        puddles.push_back(std::move(a_puddle));
    } else {
        for (const auto & e : searched_entries) {
            leaks_pos.insert(e);
        }
    }
}
开发者ID:skwllsp,项目名称:test_find_puddles,代码行数:35,代码来源:matrix.cpp

示例7: cumulativeDelta

std::vector< double > guessLambdaModifiers(
    double initialAdjustmentParameter,
    const std::vector< double > &targetBitrateVector,
    const std::list< MetaLogEntry< std::vector< double > > >& metaLogEntryList )
{
  assert( !targetBitrateVector.empty( ) );
  assert( !metaLogEntryList.empty( ) );
  
  double cumulativeDelta( 0.0 );
  std::vector< double > resultVector;
  for( unsigned char i( 0 ); i < targetBitrateVector.size( ); ++i )
  {
    // Populate pointList with up to two of the previous points
    std::list< Point > pointList;
    std::list< MetaLogEntry< std::vector< double > > >::const_reverse_iterator j( metaLogEntryList.rbegin( ) );
    pointList.push_front( pointFromFullMetaLogEntry( i, *j ) );
    ++j;
    if( j != metaLogEntryList.rend( ) ) pointList.push_front( pointFromFullMetaLogEntry( i, *j ) );
    
    // Calculate the new Lambda-modifier guess and add it to the result vector
    const double newLambdaModifier( guessLambdaModifier(
        initialAdjustmentParameter,
        targetBitrateVector[ i ],  // target bitrate
        pointList,
        interDampeningFactor( 50.0, cumulativeDelta ) ) );
    resultVector.push_back( newLambdaModifier );
    
    // Increment the cumulativeDelta
    const double oldLambdaModifier( pointList.back( ).lambdaModifier );
    cumulativeDelta += std::abs( newLambdaModifier - oldLambdaModifier ) / oldLambdaModifier;
  }
  
  return resultVector;
}
开发者ID:Rodeo314,项目名称:GitlHEVCAnalyzer,代码行数:34,代码来源:GuessLambdaModifiers.cpp

示例8: RenderChatText

void RenderChatText()
{
	// View transformation
	gGraphicsDevice->SetTransform(D3DTS_VIEW, &gOrthoViewMatrix);
	
	// Perspective transformation
	gGraphicsDevice->SetTransform(D3DTS_PROJECTION, &gScreenProjectionMatrix);

	// Render the texture
	gGraphicsDevice->BeginScene();
	{
		// render the user list
		size_t index = 0;
		int y = kFontSize / 4;
		for (auto iter=gChatUsers.rbegin(); iter != gChatUsers.rend() && index < gMaxChatLines; ++iter)
		{
			std::shared_ptr<ChatUser> user = *iter;
			RenderString(gWindowWidth-kUserListWidth, y, user->nameColorARGB, *user->font, user->username);

			y += user->font->pixelHeight + kLineSpacing;
			index++;
		}

		y = kFontSize / 4;

		// render the input text if showing
		if (gInputText != nullptr)
		{
			int x = RenderChatLine(kMessagesLeft, y, gInputText, KWhiteColor) + 2;
			RenderString(x, y, KWhiteColor, gNormalFont, "_");
			y += gInputText->font->pixelHeight + kLineSpacing;
		}

		// render the history
		for (auto iter=gChatLines.rbegin(); iter != gChatLines.rend(); ++iter)
		{
			std::shared_ptr<ChatLine> line = *iter;
			RenderChatLine(kMessagesLeft, y, line, KBlackColor);

			y += line->font->pixelHeight + kLineSpacing;
		}

		gGraphicsDevice->SetTexture(0, nullptr);
	}
	gGraphicsDevice->EndScene();
}
开发者ID:BillVee,项目名称:sdk-dist,代码行数:46,代码来源:chatrenderer_d3d.cpp

示例9: callvote_CheckForFlooding

//*****************************************************************************
//
static bool callvote_CheckForFlooding( FString &Command, FString &Parameters, ULONG ulPlayer )
{
	NETADDRESS_s	Address = SERVER_GetClient( ulPlayer )->Address;
	ULONG			ulVoteType = callvote_GetVoteType( Command );
	time_t tNow;
	time( &tNow );

	// Remove old votes that no longer affect flooding.
	while ( g_PreviousVotes.size( ) > 0 && (( tNow - g_PreviousVotes.front( ).tTimeCalled ) > VOTE_LONGEST_INTERVAL * MINUTE ))
		g_PreviousVotes.pop_front( );

	// [BB] If the server doesn't want to limit the number of votes, there is no check anything.
	// [TP] sv_limitcommands == false also implies limitless voting.
	if ( sv_limitnumvotes == false || sv_limitcommands == false )
		return true;

	// Run through the vote cache (backwards, from recent to old) and search for grounds on which to reject the vote.
	for( std::list<VOTE_s>::reverse_iterator i = g_PreviousVotes.rbegin(); i != g_PreviousVotes.rend(); ++i )
	{
		// One *type* of vote per voter per ## minutes (excluding kick votes if they passed).
		if ( !( callvote_IsKickVote ( i->ulVoteType ) && i->bPassed ) && NETWORK_CompareAddress( i->Address, Address, true ) && ( ulVoteType == i->ulVoteType ) && (( tNow - i->tTimeCalled ) < VOTER_VOTETYPE_INTERVAL * MINUTE ))
		{
			int iMinutesLeft = static_cast<int>( 1 + ( i->tTimeCalled + VOTER_VOTETYPE_INTERVAL * MINUTE - tNow ) / MINUTE );
			SERVER_PrintfPlayer( PRINT_HIGH, ulPlayer, "You must wait %d minute%s to call another %s vote.\n", iMinutesLeft, ( iMinutesLeft == 1 ? "" : "s" ), Command.GetChars() );
			return false;
		}

		// One vote per voter per ## minutes.
		if ( NETWORK_CompareAddress( i->Address, Address, true ) && (( tNow - i->tTimeCalled ) < VOTER_NEWVOTE_INTERVAL * MINUTE ))
		{
			int iMinutesLeft = static_cast<int>( 1 + ( i->tTimeCalled + VOTER_NEWVOTE_INTERVAL * MINUTE - tNow ) / MINUTE );
			SERVER_PrintfPlayer( PRINT_HIGH, ulPlayer, "You must wait %d minute%s to call another vote.\n", iMinutesLeft, ( iMinutesLeft == 1 ? "" : "s" ));
			return false;
		}

		// Specific votes ("map map30") that fail can't be re-proposed for ## minutes.
		if (( ulVoteType == i->ulVoteType ) && ( !i->bPassed ) && (( tNow - i->tTimeCalled ) < VOTE_LITERALREVOTE_INTERVAL * MINUTE ))
		{
			int iMinutesLeft = static_cast<int>( 1 + ( i->tTimeCalled + VOTE_LITERALREVOTE_INTERVAL * MINUTE - tNow ) / MINUTE );

			// Kickvotes (can't give the IP to clients!).
			if ( callvote_IsKickVote ( i->ulVoteType ) && ( !i->bPassed ) && NETWORK_CompareAddress( i->KickAddress, g_KickVoteVictimAddress, true ))
			{
				SERVER_PrintfPlayer( PRINT_HIGH, ulPlayer, "That specific player was recently on voted to be kicked or forced to spectate, but the vote failed. You must wait %d minute%s to call it again.\n", iMinutesLeft, ( iMinutesLeft == 1 ? "" : "s" ));
				return false;
			}

			// Other votes.
			if ( ( callvote_IsKickVote ( i->ulVoteType ) == false ) && ( stricmp( i->fsParameter.GetChars(), Parameters.GetChars() ) == 0 ))
			{
				SERVER_PrintfPlayer( PRINT_HIGH, ulPlayer, "That specific vote (\"%s %s\") was recently called, and failed. You must wait %d minute%s to call it again.\n", Command.GetChars(), Parameters.GetChars(), iMinutesLeft, ( iMinutesLeft == 1 ? "" : "s" ));
				return false;
			}
		}
	}

	return true;
}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:60,代码来源:callvote.cpp

示例10: searchBackToken

static std::list<TokenRec>::reverse_iterator searchBackToken(int id){
  std::list<TokenRec>::reverse_iterator iii=TokenList.rbegin();
  for ( ; iii!=TokenList.rend();iii++){
    if (id==iii->id){
      break;
    }
  }
  return iii;
}
开发者ID:kresimir71,项目名称:parea3,代码行数:9,代码来源:decorate.cpp

示例11: PopTag

void CRealTextParser::PopTag(std::list<Tag>& p_rlistTags, const std::wstring& p_crszTagName)
{
    for (std::list<Tag>::reverse_iterator riter = p_rlistTags.rbegin(); riter != p_rlistTags.rend(); ++riter) {
        if (riter->m_szName == p_crszTagName) {
            p_rlistTags.erase((++riter).base());
            return;
        }
    }
}
开发者ID:JanWillem32,项目名称:mpc-hc,代码行数:9,代码来源:RealTextParser.cpp

示例12: DrawScreenSpace

	void DrawScreenSpace (sf::RenderWindow& rwin) {
		for (typename std::list<T*>::reverse_iterator itState = stateList.rbegin();
				itState != stateList.rend(); ++itState) {
			if (!(*itState)->off) {
				(*itState)->DrawScreenSpace(rwin);
				break;
			}
		}
	}
开发者ID:matyicsapo,项目名称:Infiltrator,代码行数:9,代码来源:StateMachine.hpp

示例13: HandleSFEvents

	virtual void HandleSFEvents (std::list<sf::Event>& sfEvents) {
		for (typename std::list<T*>::reverse_iterator itState = stateList.rbegin();
				itState != stateList.rend(); ++itState) {
			if (!(*itState)->off) {
				(*itState)->HandleSFEvents(sfEvents);
				break;
			}
		}
	}
开发者ID:matyicsapo,项目名称:Infiltrator,代码行数:9,代码来源:StateMachine.hpp

示例14: erase_last

	/*
	 * Erases the last inactive element in the cache.
	 */
	bool erase_last() {
		for (auto rit = elements.rbegin(); rit != elements.rend(); ++rit) {
			if (rit->active_readers == 0) {
				erase(rit->key);
				return true;
			}
		}
		return false;
	}
开发者ID:bagobor,项目名称:psychopath,代码行数:12,代码来源:lru_cache.hpp

示例15: Pop

	void Pop (int cntToPop) {
		int i = 0;
		for (typename std::list<T*>::reverse_iterator itState = stateList.rbegin();
				itState != stateList.rend(); itState++) {
			(*itState)->pop = true;

			if (++i == cntToPop)
				break;
		}
	}
开发者ID:matyicsapo,项目名称:Infiltrator,代码行数:10,代码来源:StateMachine.hpp


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