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


C++ ptr_vector::size方法代码示例

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


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

示例1: set_prediction

void llvm_model::set_prediction(const ObsId & obs_id, boost::ptr_vector<theta::Function> & coeffs_, boost::ptr_vector<HistogramFunction> & histos_){
    observables.insert(obs_id);
    const size_t n = coeffs_.size();
    if(n!=coeffs_.size()) throw invalid_argument("Model::setPrediction: number of histograms and coefficients do not match");
    if(histos[obs_id].size()>0 || coeffs[obs_id].size()>0)
        throw invalid_argument("Model::setPrediction: prediction already set for this observable");
    coeffs[obs_id].transfer(coeffs[obs_id].end(), coeffs_.begin(), coeffs_.end(), coeffs_);
    histos[obs_id].transfer(histos[obs_id].end(), histos_.begin(), histos_.end(), histos_);
    for(boost::ptr_vector<theta::Function>::const_iterator it=coeffs[obs_id].begin(); it!=coeffs[obs_id].end(); ++it){
        ParIds pids = (*it).get_parameters();
        parameters.insert(pids.begin(), pids.end());
    }
    size_t nbins = 0;
    double xmin = NAN, xmax = NAN;
    bool first = true;
    for(boost::ptr_vector<HistogramFunction>::const_iterator it=histos[obs_id].begin(); it!=histos[obs_id].end(); ++it){
        if(first){
            it->get_histogram_dimensions(nbins, xmin, xmax);
            first = false;
        }
        else{
            size_t nbins_tmp = 0;
            double xmin_tmp = NAN, xmax_tmp = NAN;
            it->get_histogram_dimensions(nbins_tmp, xmin_tmp, xmax_tmp);
            if(nbins!=nbins_tmp || xmin!=xmin_tmp || xmax!=xmax_tmp){
                throw invalid_argument("llvm_model::set_prediction: histogram dimensions mismatch");
            }
        }
        const ParIds & pids = (*it).get_parameters();
        parameters.insert(pids.begin(), pids.end());
    }
}
开发者ID:drankincms,项目名称:David_bak,代码行数:32,代码来源:llvm_model.cpp

示例2: renderScene

void renderScene() {
    FrameTimeCounter counter;
    int avgFps = 0;
    int iterations = 0;
    while (!complete) {
        counter.BeginCounting();

        physicsWorld->Simulate(1.0f / 10.0f);

        contextPtr->BeginScene();
        contextPtr->ApplyCamera(*cameraPtr);
        //contextPtr->RenderLine(vec2(0.0f, 0.0f), vec2(100.0f, 100.0f));
        for (int i = 0; i < physicsBodies.size(); ++i) {
            physicsBodies[i].DebugRender(debugRenderer);
        }

        for (int i = 0; i < physicsJoints.size(); ++i) {
            physicsJoints[i].DebugRender(debugRenderer);
        }

        contextPtr->EndScene();



        counter.EndCounting();

        avgFps += counter.GetFps();
        iterations++;
        if (iterations > 10) {
            SetWindowTextA(hWnd, formatString("fps: %d", avgFps / iterations).c_str());
            iterations = 0;
            avgFps = 0;
        }
    }
}
开发者ID:fromtherussia,项目名称:e2d,代码行数:35,代码来源:main.cpp

示例3: from_wkb

bool geometry_utils::from_wkb(boost::ptr_vector<geometry_type>& paths,
                               const char* wkb,
                               unsigned size,
                               wkbFormat format)
{
    std::size_t geom_count = paths.size();
    wkb_reader reader(wkb, size, format);
    reader.read(paths);
    if (paths.size() > geom_count)
        return true;
    return false;
}
开发者ID:GISpecialist,项目名称:mapnik,代码行数:12,代码来源:wkb.cpp

示例4: fetch

inline bool command::fetch(std::vector<variant>& row)
{
  if (0 == m_hnd.stmt) return false;
  if (m_cols.empty()) columns();

  const sword r(lib::singleton().p_OCIStmtFetch2(m_hnd.stmt, m_hnd.err, 1, OCI_FETCH_NEXT, 1, OCI_DEFAULT));
  if (OCI_NO_DATA == r) return false;
  m_hnd.check(r);

  row.resize(m_cols.size());
  for (size_t i(0); i < m_cols.size(); ++i)
    m_cols[i](row[i]);
  return true;
}
开发者ID:igor-sadchenko,项目名称:brig,代码行数:14,代码来源:command.hpp

示例5: fetch

inline bool command::fetch(std::vector<variant>& row)
{
  if (!m_stmt) return false;
  if (m_cols.empty()) columns();

  const int r(lib::singleton().p_mysql_stmt_fetch(m_stmt));
  if (MYSQL_NO_DATA == r) return false;
  check(1 != r);

  row.resize(m_cols.size());
  for (size_t i(0); i < m_cols.size(); ++i)
    check(m_cols[i](m_stmt, (unsigned int)i, row[i]) == 0);
  return true;
}
开发者ID:respu,项目名称:brig,代码行数:14,代码来源:command.hpp

示例6: fetch

inline bool command::fetch(std::vector<variant>& row)
{
  if (lib::error(m_req)) return false;
  if (m_cols.empty()) columns();

  const int r(lib::singleton().p_cci_cursor(m_req, 1, CCI_CURSOR_CURRENT, &m_err));
  if (CCI_ER_NO_MORE_DATA == r) return false;
  check(r);
  check(lib::singleton().p_cci_fetch(m_req, &m_err));

  row.resize(m_cols.size());
  for (size_t i(0); i < m_cols.size(); ++i)
    if (lib::error(m_cols[i](m_req, i, row[i]))) throw std::runtime_error("CUBRID error");
  return true;
}
开发者ID:respu,项目名称:brig,代码行数:15,代码来源:command.hpp

示例7: specialValue

const Value MessageSelectorEnv::specialValue(const string& id) const
{
    Value v;
    // TODO: Just use a simple if chain for now - improve this later
    if ( id=="delivery_mode" ) {
        v = msg.getEncoding().isPersistent() ? PERSISTENT : NON_PERSISTENT;
    } else if ( id=="redelivered" ) {
        v = msg.getDeliveryCount()>0 ? true : false;
    } else if ( id=="priority" ) {
        v = int64_t(msg.getPriority());
    } else if ( id=="correlation_id" ) {
        MessageId cId = msg.getEncoding().getCorrelationId();
        if (cId) {
            returnedStrings.push_back(new string(cId.str()));
            v = returnedStrings[returnedStrings.size()-1];
        }
    } else if ( id=="message_id" ) {
        MessageId mId = msg.getEncoding().getMessageId();
        if (mId) {
            returnedStrings.push_back(new string(mId.str()));
            v = returnedStrings[returnedStrings.size()-1];
        }
    } else if ( id=="to" ) {
        v = EMPTY; // Hard to get this correct for both 1.0 and 0-10
    } else if ( id=="reply_to" ) {
        v = EMPTY; // Hard to get this correct for both 1.0 and 0-10
    } else if ( id=="absolute_expiry_time" ) {
        qpid::sys::AbsTime expiry = msg.getExpiration();
        // Java property has value of 0 for no expiry
        v = (expiry==qpid::sys::FAR_FUTURE) ? 0
            : qpid::sys::Duration(qpid::sys::AbsTime::Epoch(), expiry) / qpid::sys::TIME_MSEC;
    } else if ( id=="creation_time" ) {
        // Use the time put on queue (if it is enabled) as 0-10 has no standard way to get message
        // creation time and we're not paying attention to the 1.0 creation time yet.
        v = int64_t(msg.getTimestamp() * 1000); // getTimestamp() returns time in seconds we need milliseconds
    } else if ( id=="jms_type" ) {
        // Currently we can't distinguish between an empty JMSType and no JMSType
        // We'll assume for now that setting an empty JMSType doesn't make a lot of sense
        const string jmsType = msg.getAnnotation("jms-type").asString();
        if ( !jmsType.empty() ) {
            returnedStrings.push_back(new string(jmsType));
            v = returnedStrings[returnedStrings.size()-1];
        }
    } else {
        v = Value();
    }
    return v;
}
开发者ID:gregerts,项目名称:debian-qpid-cpp,代码行数:48,代码来源:Selector.cpp

示例8: sqrt

double distance::getEuclidean2(boost::ptr_vector<double>& v1, boost::ptr_vector<double>& v2)
{
	double euclidean = 0;
	int n = v1.size() == v2.size() ? v1.size() : 0;
	if (n > 0)
	{
		for (boost::ptr_vector<double>::iterator it1 = v1.begin(), it2 = v2.begin(); it1 != v1.end(), it2 != v2.end(); it1++, it2++)
		{
			euclidean += (*it1 - *it2)*(*it1 - *it2);
		}
		euclidean = sqrt(euclidean);
		return euclidean;
	}
	else
		return (double)-1;
}
开发者ID:campper,项目名称:CMS.Experiments.Console,代码行数:16,代码来源:distance.cpp

示例9: set

 void set(const string& id, const qb::Value& value) {
     if (value.type==qb::Value::T_STRING) {
         strings.push_back(new string(*value.s));
         values[id] = strings[strings.size()-1];
     } else {
         values[id] = value;
     }
 }
开发者ID:ncdc,项目名称:qpid,代码行数:8,代码来源:Selector.cpp

示例10:

typename Argc_T<CON>::type Argc_T<CON>::
getData(RLMachine& machine,
                     const boost::ptr_vector<libReallive::ExpressionPiece>& p,
                     unsigned int& position) {
  type return_vector;
  for (; position < p.size(); )
    return_vector.push_back(CON::getData(machine, p, position));

  return return_vector;
}
开发者ID:KitsuneFox89,项目名称:rlvm,代码行数:10,代码来源:Argc_T.hpp

示例11: set_target

 void set_target(engine::pointer z){
     //cooltime();
     if (cooldown < 1){
         for(short i = 0; i < ammo.size(); i++){
             if (!ammo[i].fired){
                 ammo[i].fired = true;
                 break;
             }
         }
     }
 }
开发者ID:ohmesdaddy2,项目名称:Endless-shooter,代码行数:11,代码来源:Weapon.hpp

示例12: init

 void init(unsigned int thread_count)
 {
     voxel_data.resize(thread_count);
     for (unsigned int index = 0; index < thread_count; ++index)
     {
         voxel_data[index].space.resize(q_count);
         voxel_data[index].odf.resize(ti.half_vertices_count);
         voxel_data[index].fa.resize(max_fiber_number);
         voxel_data[index].dir_index.resize(max_fiber_number);
         voxel_data[index].dir.resize(max_fiber_number);
     }
     for (unsigned int index = 0; index < process_list.size(); ++index)
         process_list[index].init(*this);
 }
开发者ID:mhough,项目名称:DSI-Studio,代码行数:14,代码来源:basic_voxel.hpp

示例13: getObjForce

    /// compute the resulting force of all force field objects.
    d_vector getObjForce(vrpn_float64 *pos, vrpn_float64 *vel) {
        int i;

        for (i=0; i<3; ++i) {
            m_curforce[i]=0.0;
            m_curpos[i]=pos[i];
            m_curvel[i]=vel[i];
        }

        // force field objects
        int nobj = m_FFEffects.size();
        for (i=0; i<nobj; ++i) {
            m_curforce = m_curforce + m_FFEffects[i].calcForce (m_curpos);
        }
        return m_curforce;
    };
开发者ID:bilke,项目名称:vrpn,代码行数:17,代码来源:vrpn_Tracker_NovintFalcon.C

示例14: thread_run

 void thread_run(unsigned char thread_index,unsigned char thread_count,
                 const std::vector<unsigned char>& mask)
 {
     unsigned int sum_mask = std::accumulate(mask.begin(),mask.end(),(unsigned int)0)/thread_count;
     unsigned int cur = 0;
     for(unsigned int voxel_index = thread_index;
         voxel_index < dim.size() &&
         (thread_index != 0 || check_prog(cur,sum_mask));voxel_index += thread_count)
     {
         if (!mask[voxel_index])
             continue;
         cur += mask[voxel_index];
         voxel_data[thread_index].init();
         voxel_data[thread_index].voxel_index = voxel_index;
         for (int index = 0; index < process_list.size(); ++index)
             process_list[index].run(*this,voxel_data[thread_index]);
         if(prog_aborted())
             break;
     }
 }
开发者ID:mhough,项目名称:DSI-Studio,代码行数:20,代码来源:basic_voxel.hpp

示例15: end

 void end(MatFile& writer)
 {
     for (unsigned int index = 0; index < process_list.size(); ++index)
         process_list[index].end(*this,writer);
 }
开发者ID:mhough,项目名称:DSI-Studio,代码行数:5,代码来源:basic_voxel.hpp


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