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


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

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


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

示例1: add

	void add(Route *rte, std::string l1, std::string l2, std::string l3, std::string c, std::string i)
	{	mtx.lock();
		entries.emplace_back(rte, l1, l2, l3, c, i);
		mtx.unlock();
	}
开发者ID:TravelMapping,项目名称:DataProcessing,代码行数:5,代码来源:DatacheckEntryList.cpp

示例2: base_url

    std::list<Maj> WebConnection::getMaj(std::list<Log>& logs)
    {
        std::list<Maj> results;
        

        QUrl base_url(Config::getUrl().c_str());
        QUrl relative_url(majUrl().c_str());
        QUrl url =  base_url.resolved(relative_url);

        request.setUrl(url);

        QNetworkReply* reply = networkManager.get(request);  // GET


        QEventLoop loop;
        QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
        loop.exec();


        if (reply->error() !=  QNetworkReply::NoError)
        {
            QMessageBox::warning(nullptr,"Error","Immpossible to connect to the url:\n"+url.toString());
            delete reply;
            return results;
        }

        QString data = (QString) reply->readAll();
        delete reply;

        QJsonDocument jsonResponse = QJsonDocument::fromJson(data.toUtf8());
        QJsonObject json = jsonResponse.object();

        int status = json.value("status").toVariant().value<int>();

        switch(status) //0:ok, 1:not soft, 2:not src version, 3:no destionation, 4:lastest
        {
            case 0: //all is good
            {
            }break;
            case 4 : //lastes
            {
                return results;
            }break;
            default:
            {
                QString msg = json.value("message").toString();
                QMessageBox::warning(nullptr,"Error","Recive error code:"+QString::number(status)
                                     +"\nMessage:"+msg);
                return results;
            }break;
        }


        QJsonObject datas = json.value("datas").toObject();
        QJsonArray files = datas.value("files").toArray();

        int _size = files.size();
        for(int i=0;i<_size;++i)
        {
            QJsonObject file = files.at(i).toObject();
            results.emplace_back(file.value("action").toVariant().value<int>(),
                                 file.value("filename").toString().toStdString(),
                                 file.value("url").toString().toStdString());
        }


        Config::setVersion(datas.value("version").toVariant().value<int>());
        Config::makeFile();


        ///LOGS
        QJsonArray qlogs = datas.value("logs").toArray();
        _size = qlogs.size();
        for(int i=0;i<_size;++i)
        {
            QJsonObject log = qlogs.at(i).toObject();
            logs.emplace_back(log.value("version").toVariant().value<int>(),
                              log.value("msg").toString().toStdString());
        }

        return results;
    }
开发者ID:Krozark,项目名称:Patcher-client,代码行数:82,代码来源:WebConnection.cpp

示例3: claim_file_hook

/// Called by gold to see whether this file is one that our plugin can handle.
/// We'll try to open it and register all the symbols with add_symbol if
/// possible.
static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
                                        int *claimed) {
  MemoryBufferRef BufferRef;
  std::unique_ptr<MemoryBuffer> Buffer;
  if (get_view) {
    const void *view;
    if (get_view(file->handle, &view) != LDPS_OK) {
      message(LDPL_ERROR, "Failed to get a view of %s", file->name);
      return LDPS_ERR;
    }
    BufferRef =
        MemoryBufferRef(StringRef((const char *)view, file->filesize), "");
  } else {
    int64_t offset = 0;
    // Gold has found what might be IR part-way inside of a file, such as
    // an .a archive.
    if (file->offset) {
      offset = file->offset;
    }
    ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
        MemoryBuffer::getOpenFileSlice(file->fd, file->name, file->filesize,
                                       offset);
    if (std::error_code EC = BufferOrErr.getError()) {
      message(LDPL_ERROR, EC.message().c_str());
      return LDPS_ERR;
    }
    Buffer = std::move(BufferOrErr.get());
    BufferRef = Buffer->getMemBufferRef();
  }

  *claimed = 1;

  Expected<std::unique_ptr<InputFile>> ObjOrErr = InputFile::create(BufferRef);
  if (!ObjOrErr) {
    handleAllErrors(ObjOrErr.takeError(), [&](const ErrorInfoBase &EI) {
      std::error_code EC = EI.convertToErrorCode();
      if (EC == object::object_error::invalid_file_type ||
          EC == object::object_error::bitcode_section_not_found)
        *claimed = 0;
      else
        message(LDPL_FATAL,
                "LLVM gold plugin has failed to create LTO module: %s",
                EI.message().c_str());
    });

    return *claimed ? LDPS_ERR : LDPS_OK;
  }

  std::unique_ptr<InputFile> Obj = std::move(*ObjOrErr);

  Modules.emplace_back();
  claimed_file &cf = Modules.back();

  cf.handle = file->handle;
  // Keep track of the first handle for each file descriptor, since there are
  // multiple in the case of an archive. This is used later in the case of
  // ThinLTO parallel backends to ensure that each file is only opened and
  // released once.
  auto LeaderHandle =
      FDToLeaderHandle.insert(std::make_pair(file->fd, file->handle)).first;
  cf.leader_handle = LeaderHandle->second;
  // Save the filesize since for parallel ThinLTO backends we can only
  // invoke get_input_file once per archive (only for the leader handle).
  cf.filesize = file->filesize;
  // In the case of an archive library, all but the first member must have a
  // non-zero offset, which we can append to the file name to obtain a
  // unique name.
  cf.name = file->name;
  if (file->offset)
    cf.name += ".llvm." + std::to_string(file->offset) + "." +
               sys::path::filename(Obj->getSourceFileName()).str();

  for (auto &Sym : Obj->symbols()) {
    cf.syms.push_back(ld_plugin_symbol());
    ld_plugin_symbol &sym = cf.syms.back();
    sym.version = nullptr;
    StringRef Name = Sym.getName();
    sym.name = strdup(Name.str().c_str());

    ResolutionInfo &Res = ResInfo[Name];

    Res.CanOmitFromDynSym &= Sym.canBeOmittedFromSymbolTable();

    sym.visibility = LDPV_DEFAULT;
    GlobalValue::VisibilityTypes Vis = Sym.getVisibility();
    if (Vis != GlobalValue::DefaultVisibility)
      Res.DefaultVisibility = false;
    switch (Vis) {
    case GlobalValue::DefaultVisibility:
      break;
    case GlobalValue::HiddenVisibility:
      sym.visibility = LDPV_HIDDEN;
      break;
    case GlobalValue::ProtectedVisibility:
      sym.visibility = LDPV_PROTECTED;
      break;
    }
//.........这里部分代码省略.........
开发者ID:mikaoP,项目名称:llvm,代码行数:101,代码来源:gold-plugin.cpp

示例4: ReportFixture

 virtual bool ReportFixture(b2Fixture* fixture) override
 {
     if(fixture->GetBody()->GetType() == b2_dynamicBody)
         fixtures.emplace_back(fixture);
     return true;
 }
开发者ID:Krozark,项目名称:SFML-book,代码行数:6,代码来源:World.cpp

示例5:

void
loaded_dll (const char *name, CORE_ADDR base_addr)
{
  all_dlls.emplace_back (name != NULL ? name : "", base_addr);
  dlls_changed = 1;
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:6,代码来源:dll.c

示例6: good_emplace_back_list1

void good_emplace_back_list1(std::list<int> &L, int n) {
  auto i0 = L.cbegin(), i1 = L.cend();
  L.emplace_back(n);
  *i0; // no-warning
  --i1; // no-warning
}
开发者ID:LegalizeAdulthood,项目名称:clang,代码行数:6,代码来源:invalidated-iterator.cpp

示例7: save_stack

void AnalyseurPeptide::save_stack(const AnalyseurPeptide::pile_tokens_ptr& search, std::list<AnalyseurPeptide::v_tokens_ptr>& res)
{
    v_tokens_ptr l;
    tokens_ptr.emplace_back(new stack_token(0.f));
    l.emplace_back(tokens_ptr.back());
    auto i=search.begin();
    auto end = search.end();

    int nb=0;
    double masse = 0;
    double intensitee = -pep->peaks[0]->intensitee;
    double errors = 0;
    double error_tot = 0;

    while(i!=end)
    {
        AnalyseurPeptide::stack_token& tmp_i= **i;

        if (tmp_i.type == AnalyseurPeptide::stack_token::Type::PEAK_TOKEN)
        {
            l.emplace_back(&tmp_i);
            Parser::peptide::peak* p = tmp_i.peak_token.pt_data;
            intensitee += p->intensitee;
            if ( pep->is_one_of_h2o(p))
                masse += MH2O;
        }
        if (tmp_i.type == AnalyseurPeptide::stack_token::Type::AA_TOKEN and tmp_i.aa_token.pt_data==NULL)
        {
            l.emplace_back(&tmp_i);
            errors += ABS(tmp_i.aa_token.error);
            error_tot += tmp_i.aa_token.error;
            masse += aa_tab[tmp_i.aa_token.index].masse;
            ++nb;
        }
        ++i;
    }
    l.shrink_to_fit();
    //add the current
    res.emplace_back(l);
    //add all other possibilites tha can be (or not) complete
    --i;//peaks
    --i;//current head
    end = search.begin();//decement
    const int size =l.size();
    while(i!=end)
    {
        AnalyseurPeptide::stack_token& tmp_i= **i;

        if(tmp_i.type == AnalyseurPeptide::stack_token::Type::PEAK_TOKEN)
        {
            break;
        }
        else if (tmp_i.type == AnalyseurPeptide::stack_token::Type::AA_TOKEN and tmp_i.aa_token.pt_data!=NULL)
        {
            l[size-2] = &tmp_i;
            l[size-1] = tmp_i.aa_token.pt_data;
            res.emplace_back(l);
        }
        --i;
    }
};
开发者ID:Krozark,项目名称:Harpe-v1.0,代码行数:61,代码来源:analyseur_peptide.cpp

示例8: addController

 void addController(Args&&... args) noexcept {
   children_.emplace_back(new T(std::forward<Args>(args)...));
 }
开发者ID:kazukin134,项目名称:BrickAndTrip,代码行数:3,代码来源:RootController.hpp

示例9: addEnetCommand

 // ------------------------------------------------------------------------
 void addEnetCommand(ENetPeer* peer, ENetPacket* packet, uint32_t i,
                     ENetCommandType ect)
 {
     std::lock_guard<std::mutex> lock(m_enet_cmd_mutex);
     m_enet_cmd.emplace_back(peer, packet, i, ect);
 }
开发者ID:toymak3r,项目名称:Beyond-The-Mirror---Weird-Rancing-Game,代码行数:7,代码来源:stk_host.hpp

示例10: Serial

	SerialList(const type& list) { std::for_each(list.begin(), list.end(),
					      [this] (typename type::const_reference v)
					      { value.emplace_back(new Serial(v)); }); }
开发者ID:Colliotv,项目名称:LaRoue,代码行数:3,代码来源:list.hpp

示例11: add_chunk

 void add_chunk() {
     m_chunks.emplace_back();
     m_chunks.back().reserve(m_chunk_size);
 }
开发者ID:tomhughes,项目名称:libosmium,代码行数:4,代码来源:string_table.hpp

示例12: AddChild

 wxDataViewItem AddChild(Combo const& combo) {
     children.emplace_back(this, combo);
     visible_items.push_back(wxDataViewItem(&children.back()));
     model->ItemAdded(wxDataViewItem(this), wxDataViewItem(&children.back()));
     return wxDataViewItem(&children.back());
 }
开发者ID:seawaveT,项目名称:Aegisub,代码行数:6,代码来源:hotkey_data_view_model.cpp

示例13: create_ipc_server

void IPC_directory::create_ipc_server(boost::asio::io_service& io_service, 
            tcp::endpoint& endpoint, observer_board& ob, int ipc_server_id) {
    std::cout << "TCP Endpoint " << endpoint << std::endl;
    ipc_servers.emplace_back(io_service, endpoint, ob, ipc_server_id);
}
开发者ID:lyz4534,项目名称:ipc_sockets_boost,代码行数:5,代码来源:IPC_directory.cpp

示例14: loadMonster

bool Monsters::loadMonster(const std::string& file, const std::string& monsterName, std::list<std::pair<MonsterType*, std::string>>& monsterScriptList, bool reloading /*= false*/)
{
	MonsterType* mType = nullptr;
	bool new_mType = true;

	pugi::xml_document doc;
	pugi::xml_parse_result result = doc.load_file(file.c_str());
	if (!result) {
		printXMLError("Error - Monsters::loadMonster", file, result);
		return false;
	}

	pugi::xml_node monsterNode = doc.child("monster");
	if (!monsterNode) {
		std::cout << "[Error - Monsters::loadMonster] Missing monster node in: " << file << std::endl;
		return false;
	}

	pugi::xml_attribute attr;
	if (!(attr = monsterNode.attribute("name"))) {
		std::cout << "[Error - Monsters::loadMonster] Missing name in: " << file << std::endl;
		return false;
	}

	if (reloading) {
		mType = getMonsterType(monsterName);
		if (mType != nullptr) {
			new_mType = false;
			mType->reset();
		}
	}

	if (new_mType) {
		mType = &monsters[asLowerCaseString(monsterName)];
	}

	mType->name = attr.as_string();

	if ((attr = monsterNode.attribute("nameDescription"))) {
		mType->nameDescription = attr.as_string();
	} else {
		mType->nameDescription = "a " + mType->name;
		toLowerCaseString(mType->nameDescription);
	}

	if ((attr = monsterNode.attribute("race"))) {
		std::string tmpStrValue = asLowerCaseString(attr.as_string());
		uint16_t tmpInt = pugi::cast<uint16_t>(attr.value());
		if (tmpStrValue == "venom" || tmpInt == 1) {
			mType->race = RACE_VENOM;
		} else if (tmpStrValue == "blood" || tmpInt == 2) {
			mType->race = RACE_BLOOD;
		} else if (tmpStrValue == "undead" || tmpInt == 3) {
			mType->race = RACE_UNDEAD;
		} else if (tmpStrValue == "fire" || tmpInt == 4) {
			mType->race = RACE_FIRE;
		} else if (tmpStrValue == "energy" || tmpInt == 5) {
			mType->race = RACE_ENERGY;
		} else {
			std::cout << "[Warning - Monsters::loadMonster] Unknown race type " << attr.as_string() << ". " << file << std::endl;
		}
	}

	if ((attr = monsterNode.attribute("experience"))) {
		mType->experience = pugi::cast<uint64_t>(attr.value());
	}

	if ((attr = monsterNode.attribute("speed"))) {
		mType->baseSpeed = pugi::cast<int32_t>(attr.value());
	}

	if ((attr = monsterNode.attribute("manacost"))) {
		mType->manaCost = pugi::cast<uint32_t>(attr.value());
	}

	if ((attr = monsterNode.attribute("skull"))) {
		mType->skull = getSkullType(attr.as_string());
	}

	if ((attr = monsterNode.attribute("script"))) {
		monsterScriptList.emplace_back(mType, attr.as_string());
	}

	pugi::xml_node node;
	if ((node = monsterNode.child("health"))) {
		if ((attr = node.attribute("now"))) {
			mType->health = pugi::cast<int32_t>(attr.value());
		} else {
			std::cout << "[Error - Monsters::loadMonster] Missing health now. " << file << std::endl;
		}

		if ((attr = node.attribute("max"))) {
			mType->healthMax = pugi::cast<int32_t>(attr.value());
		} else {
			std::cout << "[Error - Monsters::loadMonster] Missing health max. " << file << std::endl;
		}
	}

	if ((node = monsterNode.child("flags"))) {
		for (auto flagNode : node.children()) {
//.........这里部分代码省略.........
开发者ID:Codex-NG,项目名称:TFS-Flash,代码行数:101,代码来源:monsters.cpp


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