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


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

本文整理汇总了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;
}
开发者ID:graydon,项目名称:stellar-core,代码行数:56,代码来源:LedgerStateOfferSQL.cpp

示例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;
 }
开发者ID:OpsRaven,项目名称:SenecaOOP345-attic,代码行数:10,代码来源:thread-schedule.cpp

示例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);
				}
			}
		}
开发者ID:bolero-MURAKAMI,项目名称:parser_like,代码行数:34,代码来源:sentence_data.hpp

示例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();
 }
开发者ID:Whitetigerswt,项目名称:sa-modloader,代码行数:7,代码来源:streaming.cpp

示例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
}
开发者ID:LegalizeAdulthood,项目名称:clang,代码行数:6,代码来源:invalidated-iterator.cpp

示例6: emplace

 auto& emplace(Args&&... args)
 {
   auto& n = *m_children.emplace(std::forward<Args>(args)...);
   n.setParent(this);
   return n;
 }
开发者ID:OSSIA,项目名称:Score,代码行数:6,代码来源:TreeNode.hpp


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