本文整理汇总了C++中std::list::cend方法的典型用法代码示例。如果您正苦于以下问题:C++ list::cend方法的具体用法?C++ list::cend怎么用?C++ list::cend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::list
的用法示例。
在下文中一共展示了list::cend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
std::list<LedgerEntry>::const_iterator
LedgerStateRoot::Impl::loadOffers(StatementContext& prep,
std::list<LedgerEntry>& offers) const
{
std::string actIDStrKey;
unsigned int sellingAssetType, buyingAssetType;
std::string sellingAssetCode, buyingAssetCode, sellingIssuerStrKey,
buyingIssuerStrKey;
soci::indicator sellingAssetCodeIndicator, buyingAssetCodeIndicator,
sellingIssuerIndicator, buyingIssuerIndicator;
LedgerEntry le;
le.data.type(OFFER);
OfferEntry& oe = le.data.offer();
auto& st = prep.statement();
st.exchange(soci::into(actIDStrKey));
st.exchange(soci::into(oe.offerID));
st.exchange(soci::into(sellingAssetType));
st.exchange(soci::into(sellingAssetCode, sellingAssetCodeIndicator));
st.exchange(soci::into(sellingIssuerStrKey, sellingIssuerIndicator));
st.exchange(soci::into(buyingAssetType));
st.exchange(soci::into(buyingAssetCode, buyingAssetCodeIndicator));
st.exchange(soci::into(buyingIssuerStrKey, buyingIssuerIndicator));
st.exchange(soci::into(oe.amount));
st.exchange(soci::into(oe.price.n));
st.exchange(soci::into(oe.price.d));
st.exchange(soci::into(oe.flags));
st.exchange(soci::into(le.lastModifiedLedgerSeq));
st.define_and_bind();
st.execute(true);
auto iterNext = offers.cend();
while (st.got_data())
{
oe.sellerID = KeyUtils::fromStrKey<PublicKey>(actIDStrKey);
processAsset(oe.selling, (AssetType)sellingAssetType,
sellingIssuerStrKey, sellingIssuerIndicator,
sellingAssetCode, sellingAssetCodeIndicator);
processAsset(oe.buying, (AssetType)buyingAssetType, buyingIssuerStrKey,
buyingIssuerIndicator, buyingAssetCode,
buyingAssetCodeIndicator);
if (iterNext == offers.cend())
{
iterNext = offers.emplace(iterNext, le);
}
else
{
offers.emplace_back(le);
}
st.fetch();
}
return iterNext;
}
示例2: emplace_front
void emplace_front(Args&&... args) {
const bool need_reinit = (min_ == data_.cend());
data_.emplace_front(std::forward<Args>(args)...);
if (need_reinit || data_.front() < *min_) {
min_ = pointer_to_first();
}
}
示例3: 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();
}
示例4: 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;
}
示例5: 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();
}
示例6: 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());
}
}
示例7: 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;
}
示例8:
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;
}
示例9:
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;
}
示例10: 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;
}
示例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));
}
示例12: 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;
}
}
}
示例13: 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);
}
}
示例14: 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);
}
示例15: CanExplode
bool Explosion::CanExplode(const Rectangle& zone, std::list<GameObject*>& objects, const Map& map, bool& block)
{
block = false;
if (map.IsInMapBounds(zone) == false)
return false;
for (std::list<GameObject*>::const_iterator it = objects.cbegin(); it != objects.cend(); ++it)
{
if ((*it)->IsCollidingWith(zone) == true)
{
return (*it)->CanExplode(block);
}
}
return true;
}