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


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

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


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

示例1: initContacts

void ContactList::initContacts(const std::list<ContactGroup> &contactGroups)
{
    for(auto it = contactGroups.cbegin(); it != contactGroups.cend(); ++it)
    {
        const ContactGroup &group = *it;
        auto groupName = group.name;
        Wt::WPanel * panel = new Wt::WPanel;
        panel->setTitle(groupName);
        panel->setCollapsible(true);
        panel->setCentralWidget(new Wt::WContainerWidget());
        mContactPanels.insert(std::make_pair(group,panel));

        for(auto contactIt = group.contacts.cbegin(); contactIt != group.contacts.cend(); ++contactIt)
        {

            const ContactInfo &info = *contactIt;
            addContact(info.uin,info.showName);
            mContacts.push_back(info);

        }

    }

    showFullList();

}
开发者ID:ntszar,项目名称:axg,代码行数:26,代码来源:contactlist.cpp

示例2: pop_back

 /// \b Complexity: amort O(1)
 void pop_back() {
     const bool need_reinit = (min_ == pointer_to_last());
     data_.pop_back();
     if (need_reinit) {
         min_ = std::min_element(data_.cbegin(), data_.cend());
     }
 }
开发者ID:apolukhin,项目名称:queue_with_min,代码行数:8,代码来源:queue_with_min_v1.hpp

示例3: CanMoveTo

	bool Map::CanMoveTo(const GameObject* movingObject, const Rectangle& position, const std::list<GameObject*>& objects) const
	{
		if (IsInMapBounds(position) == false)
			return false;

		const MapCell* cell = GetCellFromRealPosition(position.Left(), position.Top());
		if (cell->GetIsObstacle() == true)
			return false;
		cell = GetCellFromRealPosition(position.Right() - 1, position.Top());
		if (cell->GetIsObstacle() == true)
			return false;
		cell = GetCellFromRealPosition(position.Left(), position.Bottom() - 1);
		if (cell->GetIsObstacle() == true)
			return false;
		cell = GetCellFromRealPosition(position.Right() - 1, position.Bottom() - 1);
		if (cell->GetIsObstacle() == true)
			return false;

		for (std::list<GameObject*>::const_iterator it = objects.cbegin(); it != objects.cend(); ++it)
		{
			if ((*it != movingObject) && ((*it)->IsCollidable() == true) && (*it)->IsCollidingWith(position) == true)
				return false;
		}
		return true;
	}
开发者ID:BenjaminHamon,项目名称:ClassicBomberman,代码行数:25,代码来源:Map.cpp

示例4: onMessages

void Harness::onMessages(const std::list<omx_message> &messages) {
    Mutex::Autolock autoLock(mLock);
    for (std::list<omx_message>::const_iterator it = messages.cbegin(); it != messages.cend(); ) {
        mMessageQueue.push_back(*it++);
    }
    mMessageAddedCondition.signal();
}
开发者ID:Hazy-legacy-zf2,项目名称:platform_frameworks_av,代码行数:7,代码来源:OMXHarness.cpp

示例5: print_list

void print_list(std::list<int> list, const char *key_string)
{
	std::cout << key_string << std::endl; 
	for (auto it = list.cbegin(); it != list.cend(); it++) {
		std::cout << *it;
	}
	std::cout << std::endl;
}
开发者ID:peterocean,项目名称:cplusplus-primer,代码行数:8,代码来源:list_init.cpp

示例6:

    queue_with_min& operator=(const queue_with_min& q) {
        if (this == &q) {
            return *this;
        }

        data_ = q.data_;
        min_ = std::min_element(data_.cbegin(), data_.cend());
        return *this;
    }
开发者ID:apolukhin,项目名称:queue_with_min,代码行数:9,代码来源:queue_with_min_v1.hpp

示例7: compareAdjVertices

		bool compareAdjVertices(const std::list<Edge>& adj, const std::list<int>& adjVert, int vertexToExclude) {
			bool result = true;
			
			std::list<int>::const_iterator adjVertIt = adjVert.cbegin();
			for (std::list<Edge>::const_iterator adjit = adj.cbegin(); adjit != adj.cend() && adjVertIt != adjVert.cend(); ++adjit, ++adjVertIt) {
				auto w = adjit->other(vertexToExclude);
				auto v = *adjVertIt;

				if (w == v)
					continue;

				result = false;
				break;


			}

			return result;
		}
开发者ID:viktorkuznietsov1986,项目名称:algorithms,代码行数:19,代码来源:EdgeWeightedGraphDenseTest.cpp

示例8:

std::list<std::string>
StatementPrinter::generateStatementLines(const std::list<Transaction>& transactions)
{
        std::list<std::string> statementLines;
        for (auto it = transactions.cbegin(); it != transactions.cend(); ++it) {
                this->runningBalance += it->amount();
                statementLines.push_back(generateStatementLine(*it));
        }
        return statementLines;
}
开发者ID:iainhemstock,项目名称:Katas,代码行数:10,代码来源:StatementPrinter.cpp

示例9: send_command_long_and_wait

	/**
	 * Common function for command service callbacks.
	 *
	 * NOTE: success is bool in messages, but has unsigned char type in C++
	 */
	bool send_command_long_and_wait(uint16_t command, uint8_t confirmation,
			float param1, float param2,
			float param3, float param4,
			float param5, float param6,
			float param7,
			unsigned char &success, uint8_t &result) {
		unique_lock lock(mutex);

		/* check transactions */
		for (auto it = ack_waiting_list.cbegin();
				it != ack_waiting_list.cend(); it++)
			if ((*it)->expected_command == command) {
				ROS_WARN_THROTTLE_NAMED(10, "cmd", "Command %u alredy in progress", command);
				return false;
			}

		//! @note APM always send COMMAND_ACK, while PX4 never.
		bool is_ack_required = (confirmation != 0 || uas->is_ardupilotmega()) && !uas->is_px4();
		if (is_ack_required)
			ack_waiting_list.push_back(new CommandTransaction(command));

		command_long(command, confirmation,
				param1, param2,
				param3, param4,
				param5, param6,
				param7);

		if (is_ack_required) {
			auto it = ack_waiting_list.begin();
			for (; it != ack_waiting_list.end(); it++)
				if ((*it)->expected_command == command)
					break;

			if (it == ack_waiting_list.end()) {
				ROS_ERROR_NAMED("cmd", "CommandTransaction not found for %u", command);
				return false;
			}

			lock.unlock();
			bool is_not_timeout = wait_ack_for(*it);
			lock.lock();

			success = is_not_timeout && (*it)->result == MAV_RESULT_ACCEPTED;
			result = (*it)->result;

			delete *it;
			ack_waiting_list.erase(it);
		}
		else {
			success = true;
			result = MAV_RESULT_ACCEPTED;
		}

		return true;
	}
开发者ID:mthz,项目名称:mavros,代码行数:60,代码来源:command.cpp

示例10: OnUserInfoChange

void ChatroomFrontpage::OnUserInfoChange(const std::list<nim::UserNameCard> &uinfos)
{
	for (auto iter = uinfos.cbegin(); iter != uinfos.cend(); iter++)
	{
		if (nim_ui::LoginManager::GetInstance()->IsEqual(iter->GetAccId()))
		{
			InitHeader();
			break;
		}
	}
}
开发者ID:netease-im,项目名称:NIM_PC_Demo,代码行数:11,代码来源:chatroom_frontpage.cpp

示例11:

QuadNode::QuadNode(int id, int x, int y, int width, int height, std::list<NodeObject*> listNodeObject)
{
	_id = id;
	_bouding._x = x;
	_bouding._y = y;
	_bouding._w = width;
	_bouding._h = height;
	

	std::move(listNodeObject.cbegin(), listNodeObject.cend(), std::back_inserter(_listNodeObject));
}
开发者ID:kjngstars,项目名称:GameProject2015,代码行数:11,代码来源:QuadTree.cpp

示例12: installAutoMagic

void AutoMagic::installAutoMagic(SeparatistaDocument *pDocument)
{
	DEBUG_STATIC_METHOD;

	typedef struct
	{
		void (*pfnCreateAutoMagicFactory)(SeparatistaDocument *pDocument, const wchar_t *pBasePath, const wchar_t *pWatchPath, const wchar_t *pValuePath);
		const wchar_t *pBasePath;
		const wchar_t *pWatchPath;
		const wchar_t *pValuePath;
	} AutoMagicInfo;

	// Insert new automagic here
	std::unordered_map<std::wstring, const std::initializer_list<AutoMagicInfo>> autoMagicMap =
	{
		{
			Separatista::camt_053_001_02::Namespace,
				{
					// Order is important here, value elements being watched should be created last
				}
		},
		{
			Separatista::pain_001_001_03::Namespace,
				{
					// Order is important here, value elements being watched should be created last
				}
		},
		{
			Separatista::pain_008_001_02::Namespace, 
				{
					// Order is important here, value elements being watched should be created last
					{
						AutoMagicFactory<SumAutoMagic>::Create, TEXT("CstmrDrctDbtInitn"), TEXT("PmtInf/NbOfTxs"), TEXT("GrpHdr/NbOfTxs")
					},
					{
						AutoMagicFactory<SumAutoMagic>::Create, TEXT("CstmrDrctDbtInitn"), TEXT("PmtInf/CtrlSum"), TEXT("GrpHdr/CtrlSum")
					},
					{
						AutoMagicFactory<CountAutoMagic>::Create, TEXT("CstmrDrctDbtInitn/PmtInf"), TEXT("DrctDbtTxInf"), TEXT("NbOfTxs")
					},
					{
						AutoMagicFactory<SumAutoMagic>::Create, TEXT("CstmrDrctDbtInitn/PmtInf"), TEXT("DrctDbtTxInf/InstdAmt"), TEXT("CtrlSum")
					}
				} 
		}
	};

	const std::list<AutoMagicInfo> infoList = autoMagicMap[pDocument->getNamespaceURI()];
	for (auto info = infoList.cbegin(); info != infoList.cend(); info++)
	{
		info->pfnCreateAutoMagicFactory(pDocument, info->pBasePath, info->pWatchPath, info->pValuePath);
	}
}
开发者ID:zwartetoorts,项目名称:separatista,代码行数:53,代码来源:automagic.cpp

示例13:

std::vector<PartialPaint> GraphPaintingGenerator::getNextGeneration(const PartialPaint & cr_curPainting) const
{
	{
		// calc what vertex is next
		PartialPaint::const_iterator iter = --cr_curPainting.end();
		int whoIsNext = (*iter).first + 1;
		int maxColor = cr_curPainting.ColorsCount;

		// reserve memory for items
		std::vector<PartialPaint> answer;
		answer.reserve(iter->second);


		// get adjacent vertexes and check their colors to know what colors are free
		const std::list<int> adjacentVertexes = m_pGraph->getAllAdjancentVertexes(whoIsNext);
		// colors that are not free
		std::unordered_set<int> candidatesSet;
		for (std::list<int>::const_iterator it = adjacentVertexes.cbegin(); it != adjacentVertexes.end(); it++)
		{
			int curNeighbor = (*it);
			for (PartialPaint::const_iterator it2 = cr_curPainting.cbegin(); it2 != cr_curPainting.end(); it2++)
			{
				int curVert = (*it2).first;
				if (curVert == curNeighbor)
				{
					int curColor = (*it2).second;
					candidatesSet.insert(curColor);
				}
			}
		}

		// get set of partialPainting by painting cur vertex in one of the free color
		for (int color = 0; color < maxColor; color++)
		{
			if (candidatesSet.find(color) != candidatesSet.end())
				continue;
			PartialPaint tmp = cr_curPainting;
			tmp.push_back(VertexColorPair(whoIsNext, color));
			answer.push_back(tmp);
		}

		// if couldnt paint in color, we add new color
		if (answer.size() == 0)
		{
			PartialPaint tmp = cr_curPainting;
			tmp.push_back(VertexColorPair(whoIsNext, maxColor));
			tmp.ColorsCount = maxColor + 1;
			answer.push_back(tmp);
		}

		return answer;
	}
}
开发者ID:Dmitry94,项目名称:ScienceWork,代码行数:53,代码来源:GenerateNewPainting.cpp

示例14:

iter
search(const std::list<int> & li, const int num) {
	static iter sp = li.cbegin();	// last time found
	const static iter iter_end = li.cend();

	if(sp == iter_end)
		sp = li.cbegin();

	while(*sp != num && sp != iter_end) {
		if(*sp > num) {
			--sp;
			if(*sp < num)
				sp = iter_end;
		} else {
			++sp;
			if(*sp > num)
				sp = iter_end;
		}//if-else
	}//while

	return sp;
}//search
开发者ID:adamcavendish,项目名称:HomeworkGitShare,代码行数:22,代码来源:No_10.cpp

示例15: handle_command_ack

	void handle_command_ack(const mavlink::mavlink_message_t *msg, mavlink::common::msg::COMMAND_ACK &ack)
	{
		lock_guard lock(mutex);
		for (auto it = ack_waiting_list.cbegin();
				it != ack_waiting_list.cend(); it++)
			if ((*it)->expected_command == ack.command) {
				(*it)->result = ack.result;
				(*it)->ack.notify_all();
				return;
			}

		ROS_WARN_THROTTLE_NAMED(10, "cmd", "CMD: Unexpected command %u, result %u",
				ack.command, ack.result);
	}
开发者ID:FOXTTER,项目名称:mavros,代码行数:14,代码来源:command.cpp


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