本文整理汇总了C++中CONT::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CONT::end方法的具体用法?C++ CONT::end怎么用?C++ CONT::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CONT
的用法示例。
在下文中一共展示了CONT::end方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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);
}
示例2: ans
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;
}
示例3: 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("");
}
}
}
}