本文整理汇总了C++中std::list::emplace方法的典型用法代码示例。如果您正苦于以下问题:C++ list::emplace方法的具体用法?C++ list::emplace怎么用?C++ list::emplace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::list
的用法示例。
在下文中一共展示了list::emplace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: schedule
task_handle schedule(task_type&& task, const time_point& start, const duration& repeat=duration::zero()) {
task_handle h;
{
std::lock_guard<std::mutex> lk(mutex);
h = tasks.emplace(tasks.end(), std::move(task), start, repeat);
handles.push_back(h);
}
tasks_updated.notify_all();
return h;
}
示例3: if
template<class... Ts>void init(Ts... args)
{
init_impl(args...);
if (sizeof...(Ts) <= 1)
return;
auto ite = sentence.begin();
auto before = sentence.begin();
++ite;
auto end = sentence.end();
for (; ite != end; ++ite)
{
before = std::prev(ite);
if ((*before).type_ == parse_helper::data_type::token &&
(*ite).type_ == parse_helper::data_type::token)
{
sentence.emplace(ite, " ");
sentence.emplace(ite, placeholder::space_holder);
}
else if ((*before).type_ == parse_helper::data_type::token &&
(*ite).type_ == parse_helper::data_type::string&&
token_string_check(*(*ite).str_.c_str()))
{
sentence.emplace(ite, " ");
sentence.emplace(ite, placeholder::space_holder);
}
else if((*ite).type_ == parse_helper::data_type::token &&
(*before).type_ == parse_helper::data_type::string &&
token_string_check(*(std::prev((*before).str_.end()))))
{
sentence.emplace(ite, " ");
sentence.emplace(ite, placeholder::space_holder);
}
}
}
示例4: AllocBufferForString
// Allocates a buffer that lives for the entire life time of the app
// Used by HOOK_SetImgDscName
const char* AllocBufferForString(const char* str)
{
static std::list<std::string> buffers;
return buffers.emplace(buffers.end(), str)->c_str();
}
示例5: good_emplace_list1
void good_emplace_list1(std::list<int> &L, int n) {
auto i1 = L.cbegin(), i0 = i1++;
L.emplace(i1, n);
*i0; // no-warning
*i1; // no-warning
}
示例6: emplace
auto& emplace(Args&&... args)
{
auto& n = *m_children.emplace(std::forward<Args>(args)...);
n.setParent(this);
return n;
}