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


C++ CONT类代码示例

本文整理汇总了C++中CONT的典型用法代码示例。如果您正苦于以下问题:C++ CONT类的具体用法?C++ CONT怎么用?C++ CONT使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: date_intersection

void
date_intersection(const CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >& cont,
                  II output_dates)
{
    std::vector<TDATE> inBuff;
    std::vector<TDATE> outBuff;

    typename CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >::const_iterator it = cont.begin();

    // pre-load dates for first series
    std::copy(it->getDates(),it->getDates() + it->nrow(),
              std::inserter(inBuff,inBuff.begin()));

    for(it = cont.begin() + 1; it != cont.end(); it++) {
        outBuff.clear();
        set_intersection(inBuff.begin(),inBuff.end(),
                         it->getDates(),it->getDates() + it->nrow(),
                         std::inserter(outBuff,outBuff.begin()));
        // swap buffs
        inBuff.clear();
        std::copy(outBuff.begin(),outBuff.end(),
                  std::inserter(inBuff,inBuff.begin()));
    }
    std::copy(outBuff.begin(),outBuff.end(),output_dates);
}
开发者ID:gsidaytrader,项目名称:tslib,代码行数:25,代码来源:cbind.hpp

示例2: getContourCentre

//Получение координат центра контура
Point getContourCentre(CONT& vec)
{
    double tempx = 0.0, tempy = 0.0;
    for (int i = 0; i < vec.size(); i++) {
        tempx += vec[i].x;
        tempy += vec[i].y;
    }
    return Point(tempx / (double)vec.size(), tempy / (double)vec.size());
}
开发者ID:BulatSuleymanoff,项目名称:qr-code-detector,代码行数:10,代码来源:qr_code_detector_source.cpp

示例3: cbind_max_nrow

TSDIM
cbind_max_nrow(const CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >& cont)
{
    std::vector<TSDIM> nrows;
    typename CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >::const_iterator it;
    for(it = cont.begin(); it != cont.end(); it++) {
        nrows.push_back(it->nrow());
    }
    return *max_element(nrows.begin(), nrows.end());
}
开发者ID:gsidaytrader,项目名称:tslib,代码行数:10,代码来源:cbind.hpp

示例4: cbind_total_cols

TSDIM
cbind_total_cols(const CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >& cont)
{
    TSDIM ans = 0;
    typename CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >::const_iterator it;
    for(it = cont.begin(); it != cont.end(); it++) {
        ans += it->ncol();
    }
    return ans;
}
开发者ID:gsidaytrader,项目名称:tslib,代码行数:10,代码来源:cbind.hpp

示例5: isContourInsideContour

//Проверка находится ли один контур в другом
bool isContourInsideContour(CONT& in, CONT& out)
{
	//каждую точку внутреннего контура проверяем на нахождение во внешнем контуре
    for(int i = 0; i < in.size(); i++){
        if(pointPolygonTest(out, in[i], false) <= 0) return false; //проверка, находится ли точка внутри контура
    }
    return true;
}
开发者ID:BulatSuleymanoff,项目名称:qr-code-detector,代码行数:9,代码来源:qr_code_detector_source.cpp

示例6: date_union

void
date_union(const CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >& cont,
           II output_dates)
{
    std::set<TDATE> ans;
    typename CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >::const_iterator it;

    // walk through all tseries adding all dates
    // let std::set drop dups for us
    for(it = cont.begin(); it != cont.end(); it++) {
        TDATE* dts = it->getDates();
        for(TSDIM i = 0; i < it->nrow(); i++) {
            ans.insert(dts[i]);
        }
    }
    std::copy(ans.begin(), ans.end(), output_dates);
}
开发者ID:gsidaytrader,项目名称:tslib,代码行数:17,代码来源:cbind.hpp

示例7: cbind

TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy>
cbind(const CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >& cont,
      const bool intersection)
{
    size_t sz = cont.size();
    if(sz == 0) {
        return TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy>();
    }
    if(sz == 1) {
        return *cont.begin();
    }

    std::vector<TDATE> ans_dates;
    if(intersection) {
        date_intersection(cont,std::inserter(ans_dates,ans_dates.begin()));
    } else {
        date_union(cont,std::inserter(ans_dates,ans_dates.begin()));
    }

    if(ans_dates.size() == 0) {
        return TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy>();
    }

    TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> ans(ans_dates.size(),cbind_total_cols(cont));
    std::copy(ans_dates.begin(), ans_dates.end(), ans.getDates());
    // FIXME: set colnames

    // if union, then we must initialize the values of ans to NA
    if(!intersection) {
        for(TSDIM i = 0; i < ans.nrow() * ans.ncol(); i++) {
            ans.getData()[i] = numeric_traits<TDATA>::NA();
        }
    }

    typename CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >::const_iterator it = cont.begin();

    // walk along iterator and map values into ans
    TSDIM offset = 0;
    while(it != cont.end()) {
        cbind_map_values(ans, *it, offset);
        offset += it->ncol();
        ++it;
    }
    return ans;
}
开发者ID:gsidaytrader,项目名称:tslib,代码行数:45,代码来源:cbind.hpp

示例8: cbind_create_colnames

void cbind_create_colnames(const CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >& cont,
                           II new_colnames)
{
    typename CONT<TSeries<TDATE,TDATA,TSDIM,TSDATABACKEND,DatePolicy> >::const_iterator it;
    for(it = cont.begin(); it != cont.end(); it++) {
        std::vector<std::string> this_cnames;
        // if series has non-empty colnames, pad them into new_colnames
        // otherwise pad empty strings

        //FIXME: add a test for all series having empty colnames, then ans should not have blnk strings set as colnames
        if(this_cnames.size()) {
            for(std::vector<std::string>::const_iterator cn_it = this_cnames.begin(); it != this_cnames.end(); cn_it++) {
                *new_colnames++ = *cn_it;
            }
        } else {
            for(int i = 0; i < it->ncol(); i++) {
                *new_colnames++ = std::string("");
            }
        }
    }

}
开发者ID:gsidaytrader,项目名称:tslib,代码行数:22,代码来源:cbind.hpp

示例9: push_front

 void push_front(CONT& cont, T const& x) { cont.push_front(x); }
开发者ID:staticimport,项目名称:perftest,代码行数:1,代码来源:sequential_test.cpp

示例10: write_array

void write_array(const CONT<T, K>& a, std::ostream& s)
{
	write_size(a.size(), s);
	write(a, s);
}
开发者ID:iavr,项目名称:drvq,代码行数:5,代码来源:ivl_io.hpp

示例11: push_back

 void push_back(CONT& cont, T const& x) { cont.push_back(x); }
开发者ID:staticimport,项目名称:perftest,代码行数:1,代码来源:sequential_test.cpp

示例12: insert

 ITER insert(CONT& cont, ITER& iter, T const& x)
 {
   return cont.insert(iter, x);
 }
开发者ID:staticimport,项目名称:perftest,代码行数:4,代码来源:sequential_test.cpp

示例13: empty

 bool empty() const {      // return whether the stack is empty
     return elems.empty();
 }
开发者ID:hzsunzixiang,项目名称:programming,代码行数:3,代码来源:stack3.hpp

示例14: empty

 bool empty() const
 {
     return elems.empty();
 }
开发者ID:OJ-China,项目名称:language,代码行数:4,代码来源:Stack.hpp

示例15: empty

 //empty
 bool empty() {return container.size() == 0;}
开发者ID:gfoxx,项目名称:git-sandbox,代码行数:2,代码来源:stackt.hpp


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