这篇教程C++ to_string函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中to_string函数的典型用法代码示例。如果您正苦于以下问题:C++ to_string函数的具体用法?C++ to_string怎么用?C++ to_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了to_string函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ASSERTJson::Value sinsp_filter_check::rawval_to_json(uint8_t* rawval, const filtercheck_field_info* finfo, uint32_t len){ ASSERT(rawval != NULL); ASSERT(finfo != NULL); switch(finfo->m_type) { case PT_INT8: if(finfo->m_print_format == PF_DEC) { return *(int8_t *)rawval; } else if(finfo->m_print_format == PF_HEX) { return rawval_to_string(rawval, finfo, len); } else { ASSERT(false); return Json::Value::null; } case PT_INT16: if(finfo->m_print_format == PF_DEC) { return *(int16_t *)rawval; } else if(finfo->m_print_format == PF_HEX) { return rawval_to_string(rawval, finfo, len); } else { ASSERT(false); return Json::Value::null; } case PT_INT32: if(finfo->m_print_format == PF_DEC) { return *(int32_t *)rawval; } else if(finfo->m_print_format == PF_HEX) { return rawval_to_string(rawval, finfo, len); } else { ASSERT(false); return Json::Value::null; } case PT_INT64: case PT_PID: if(finfo->m_print_format == PF_DEC) { return (Json::Value::Int64)*(int64_t *)rawval; } else { return rawval_to_string(rawval, finfo, len); } case PT_L4PROTO: // This can be resolved in the future case PT_UINT8: if(finfo->m_print_format == PF_DEC) { return *(uint8_t *)rawval; } else if(finfo->m_print_format == PF_HEX) { return rawval_to_string(rawval, finfo, len); } else { ASSERT(false); return Json::Value::null; } case PT_PORT: // This can be resolved in the future case PT_UINT16: if(finfo->m_print_format == PF_DEC) { return *(uint16_t *)rawval; } else if(finfo->m_print_format == PF_HEX) { return rawval_to_string(rawval, finfo, len); } else { ASSERT(false); return Json::Value::null; } case PT_UINT32: if(finfo->m_print_format == PF_DEC) { return *(uint32_t *)rawval; }//.........这里部分代码省略.........
开发者ID:elfchief,项目名称:sysdig,代码行数:101,
示例2: invalid_argumentvoid CerrarArchivoNode::ValidateSemantic(){ TypeNode* type = archiveToClose->ValidateSemantic(); if (type->GetName().compare("TypeArchivo")!=0) throw invalid_argument("Se esperaba que variable fuera de tipo archivo. Columna: "+to_string(column)+" Fila: "+to_string(row) );}
开发者ID:armejiaf,项目名称:CompiProject,代码行数:7,
示例3: draw//.........这里部分代码省略......... glDisable(GL_TEXTURE_GEN_T); } } // update starburst static float starBurstTime = 300.0f; // burst after 5 minutes starBurstTime -= inSettings->frameTime; if(starBurstTime <= 0.0f){ float pos[] = {inSettings->camPos[0] + (pathDir[0] * inSettings->depth * (0.5f + rsRandf(0.5f))), rsRandf(2.0f) - 1.0f, inSettings->camPos[2] + (pathDir[2] * inSettings->depth * (0.5f + rsRandf(0.5f)))}; inSettings->theStarBurst->restart(pos); // it won't actually restart unless it's ready to starBurstTime = rsRandf(240.0f) + 60.0f; // burst again within 1-5 minutes } if(inSettings->dShaders) inSettings->theStarBurst->draw(lerp, inSettings); else inSettings->theStarBurst->draw(inSettings); // draw tunnel if(inSettings->dUseTunnels){ inSettings->theTunnel->make(inSettings->frameTime, inSettings->dShaders); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); glEnable(GL_TEXTURE_2D); if(inSettings->dShaders){ glActiveTextureARB(GL_TEXTURE1_ARB); glBindTexture(GL_TEXTURE_2D, inSettings->theCausticTextures->caustictex[(inSettings->whichTexture + 1) % inSettings->numAnimTexFrames]); glActiveTextureARB(GL_TEXTURE0_ARB); glBindTexture(GL_TEXTURE_2D, inSettings->theCausticTextures->caustictex[inSettings->whichTexture]); glUseProgramObjectARB(tunnelProgram); inSettings->theTunnel->draw(lerp); glUseProgramObjectARB(0); } else{ glBindTexture(GL_TEXTURE_2D, inSettings->theCausticTextures->caustictex[inSettings->whichTexture]); inSettings->theTunnel->draw(); } glDisable(GL_CULL_FACE); } // draw sun with lens flare glDisable(GL_FOG); float flarepos[3] = {0.0f, 2.0f, 0.0f}; glBindTexture(GL_TEXTURE_2D, inSettings->flaretex[0]); inSettings->sunStar->draw(inSettings->camPos, inSettings->unroll, inSettings->modelMat, inSettings->projMat, inSettings->viewport); float diff[3] = {flarepos[0] - inSettings->camPos[0], flarepos[1] - inSettings->camPos[1], flarepos[2] - inSettings->camPos[2]}; float alpha = 0.5f - 0.005f * sqrtf(diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2]); if(alpha > 0.0f) flare(flarepos, 1.0f, 1.0f, 1.0f, alpha, inSettings); glEnable(GL_FOG); // measure draw time //drawTime += drawTimer.tick(); // write text static float totalTime = 0.0f; totalTime += inSettings->frameTime; static std::vector<std::string> strvec; static int frames = 0; ++frames; if(frames == 60){ strvec.clear(); std::string str1 = " FPS = " + to_string(60.0f / totalTime); strvec.push_back(str1); std::string str2 = "compute time = " + to_string(computeTime / 60.0f); strvec.push_back(str2); std::string str3 = " draw time = " + to_string(drawTime / 60.0f); strvec.push_back(str3); totalTime = 0.0f; computeTime = 0.0f; drawTime = 0.0f; frames = 0; } if(inSettings->kStatistics){ glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(0.0f, 50.0f * inSettings->aspectRatio, 0.0f, 50.0f, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glTranslatef(1.0f, 48.0f, 0.0f); glColor3f(1.0f, 0.6f, 0.0f); inSettings->textwriter->draw(strvec); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); } #ifdef WIN32 wglSwapLayerBuffers(hdc, WGL_SWAP_MAIN_PLANE);#endif#ifdef RS_XSCREENSAVER glXSwapBuffers(xdisplay, xwindow);#endif}
开发者ID:Web5design,项目名称:hyperspace,代码行数:101,
示例4: LOGGER_WRITE_TUPLEvoid SimManager::writeProperties(){ // declaration for Logging std::pair<LogCategory, LogLevel> logM = Logger::getLogMode(LC_SOLV, LL_INFO); LOGGER_WRITE_TUPLE("SimManager: Computation time", logM); LOGGER_WRITE_TUPLE("SimManager: Simulation end time: " + to_string(_tEnd), logM); //LOGGER_WRITE("Rechenzeit in Sekunden: " + to_string>(_tClockEnd-_tClockStart), logM); LOGGER_WRITE_TUPLE("Simulation info from solver:", logM); _solver->writeSimulationInfo();/* // Zeit if(_settings->_globalSettings->bEndlessSim) { LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Geforderte Simulationszeit: endlos"),logM); //LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Rechenzeit: ") + boost::lexical_cast<std::string>(_tClockEnd-_tClockStart),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Endzeit Toleranz: ") + boost::lexical_cast<std::string>(config->getSimControllerSettings()->dTendTol),logM); } else { LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Geforderte Simulationszeit: ") + boost::lexical_cast<std::string>(_tEnd),logM); //_infoStream << "Rechenzeit: " << (_tClockEnd-_tClockStart); //LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Rechenzeit: ") + boost::lexical_cast<std::string>(_tClockEnd-_tClockStart),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Endzeit Toleranz: ") + boost::lexical_cast<std::string>(_config->getSimControllerSettings()->dTendTol),logM); } if(_settings->_globalSettings->bRealtimeSim) { LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Echtzeit Simulationszeit aktiv:"),logM); log->wirte(boost::lexical_cast<std::string>("Faktor: ") + boost::lexical_cast<std::string>(_settings->_globalSettings->dRealtimeFactor),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Aktive Rechenzeit (Pause Zeit): ") + boost::lexical_cast<std::string>(_tClockEnd-_tClockStart-_dataPool->getPauseDelay()) + boost::lexical_cast<std::string>("(") + boost::lexical_cast<std::string>(_dataPool->getPauseDelay()) + boost::lexical_cast<std::string>(")"),logM); } if(_dimSolver == 1) { if(!(_solver->getSolverStatus() & ISolver::ERROR_STOP)) LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Simulation erfolgreich."),logM); else LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Fehler bei der Simulation!"),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Schritte insgesamt des Solvers: ") + boost::lexical_cast<std::string>(_totStps.at(0)),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Akzeptierte Schritte des Solvers: ") + boost::lexical_cast<std::string>(_accStps.at(0)),logM); log->wrtie(boost::lexical_cast<std::string>("Verworfene Schritte des Solvers: ") + boost::lexical_cast<std::string>(_rejStps.at(0)),logM); if(Logger::getInstance()->isOutput(logM) _solver->writeSimulationInfo(); } else { LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Anzahl Solver: ") + boost::lexical_cast<std::string>(_dimSolver),logM) ; if(_completelyDecoupledSystems || !(_settings->bDynCouplingStepSize)) { LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Koppelschrittweitensteuerung: fix "),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Ausgabeschrittweite: ") + boost::lexical_cast<std::string>(_config->getGlobalSettings()->gethOutput()),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Koppelschrittweite: ") + boost::lexical_cast<std::string>(_settings->dHcpl), logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Anzahl Koppelschritte: ") + boost::lexical_cast<std::string>(_totCouplStps),logM) ; if(abs(_settings->_globalSettings->tEnd - _tEnd) < 10*UROUND) LOGGER_WRITE(boost::lexical_cast<std::string>("Integration erfolgreich. IDID= ") + boost::lexical_cast<std::string>(_dbgId), logM); else LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Solver run time simmgr_error. "),logM); } else { LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Koppelschrittweitensteuerung: dynamisch"),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Ausgabeschrittweite: ") + boost::lexical_cast<std::string>(_config->getGlobalSettings()->gethOutput()),logM); LOGGER_WRITE_TUPLE(boost::lexical_cast<std::string>("Koppelschrittweite für n C++ to_struct_type函数代码示例 C++ to_sport函数代码示例
|