本文整理汇总了C++中Dlist::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Dlist::size方法的具体用法?C++ Dlist::size怎么用?C++ Dlist::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dlist
的用法示例。
在下文中一共展示了Dlist::size方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cumulate
Dlist cumulate(const Dlist& L) {
Dlist l = initDlist(L.size());
double a = 0;
for (int i=0; i<L.size(); i++) {
a += L[i];
l[i] = a;
}
return l;
}
示例2: tabular_result_output
void tabular_result_output(const Dlist<string>& words,int cols) {
cout<<"<table>\n<tr>\n";
int rowpos=0;
for(int i=0;i<words.size();i++) {
cout<<"<td>"<<words[i]<<"</td>\n";
if(!(++rowpos%cols) && (i+1 != words.size())) cout<<"</tr>\n<tr>\n";
}
cout<<"</tr>\n</table>\n";
}
示例3: histogram
Dlist histogram(const Dlist& L, double interval) {
Dlist hist; int l = L.size();
for(int i=0; i<l; i++) {
double a = L[i];
if (a!=-1) {
if (a<0) { printf("Error in print_hist, neg\n"); fl(); }
int n = floor(a/interval);
if (n>=hist.size()) { hist.resize(n+1); hist[n] = 0;}
hist[n]++;
}
}
return hist;
}
示例4: main
int main()
{
Dlist<int> dlist;
int i=dlist.size();
std::cout<<i<<std::endl;
dlist.push_back(2);
for (int j1=0; j1<dlist.size(); ++j1)
std::cout<<dlist.value(j1+1)<<'-';
std::cout<<std::endl;
dlist.push_front(4);
for (int j2=0; j2<dlist.size(); ++j2)
std::cout<<dlist.value(j2+1)<<'-';
std::cout<<std::endl;
dlist.insert_after(7,1);
i=dlist.size();
std::cout<<i<<std::endl;
for (int j3=0; j3<dlist.size(); ++j3)
std::cout<<dlist.value(j3+1)<<'-';
std::cout<<std::endl;
dlist.reverse();
std::cout<<dlist.size()<<std::endl;
for (int j4=0; j4<dlist.size(); ++j4)
std::cout<<dlist.value(j4+1)<<'-';
std::cout<<std::endl;
dlist.clear();
std::cout<<dlist.size()<<std::endl;
return 0;
}
示例5: percents
Dlist percents(const Dlist& L, double n) {
Dlist Dl;
for (int i=0; i<L.size(); i++) {
Dl.push_back(percent(L[i],n));
}
return Dl;
}
示例6: get_permut_sort
List get_permut_sort(const List& l) {
List perm = initList(l.size());
Dlist lp = var(l);
Dlist L = lp;
std::sort(L.begin(), L.end());
for (int i=0; i<L.size(); i++) {
int pos = isfound_pos(L[i],lp);
if (pos==-1) printf("Error in get_permut_sort\n");
else perm[i] = pos;
}
return perm;
}
示例7: El_record_maxreduce_info_in_attr
void El_record_maxreduce_info_in_attr(Hyperblock *hb)
{
Control_cpr_info *attr;
int size, i;
Operand br_pred, ft_pred;
Hash_set<Operand> cpr_preds(hash_operand), derived_on_preds(hash_operand), derived_off_preds(hash_operand);
if (dbg(cpr, 3))
cdbg << "Enter El_record_maxreduce_info_in_attr: " << hb->id() << endl;
attr = get_control_cpr_info(hb);
if (attr != NULL)
El_punt("El_record_maxreduce_info_in_attr: HB %d already has an attr",
hb->id());
size = hb_br_preds.size();
attr = new Control_cpr_info(size);
// Compute set of all preds used for cpr, cpr_preds
for (Dlist_iterator<Operand> dl_i(hb_br_preds); dl_i!=0; dl_i++) {
cpr_preds += (*dl_i);
}
for (Dlist_iterator<Operand> dl_i2(hb_ft_preds); dl_i2!=0; dl_i2++) {
cpr_preds += (*dl_i2);
}
for (i=0; i<size; i++) {
br_pred = hb_br_preds.pop();
ft_pred = hb_ft_preds.pop();
if (dbg(cpr, 3))
cdbg << "i " << i << " on_trace_pred " << ft_pred
<< " off_trace_pred " << br_pred << endl;
attr->set_on_trace_pred(i, ft_pred);
attr->set_off_trace_pred(i, br_pred);
El_compute_maxreduce_derived_preds(hb, ft_pred, br_pred, cpr_preds,
derived_on_preds, derived_off_preds);
if (derived_on_preds.size() > 0)
attr->set_derived_on_trace_pred(i, derived_on_preds);
if (derived_off_preds.size() > 0)
attr->set_derived_off_trace_pred(i, derived_off_preds);
}
set_control_cpr_info(hb, attr);
}
示例8: division
Dlist division(const Dlist& L, double d) {
Dlist Dl;
for (int i=0; i<L.size(); i++) Dl.push_back(L[i]/d);
return Dl;
}
示例9: isfound_pos
int isfound_pos(double n, const Dlist& L) {
if (L.size()==0) return -1;
for (int i=0; i<L.size(); i++) if (L[i]==n) return i;
return -1;
}
示例10: sumlist
double sumlist(const Dlist& L) {
double d = 0;
for (int l=0; l<L.size(); l++) d += L[l];
return d;
}
示例11: print_Dlist
void print_Dlist(str s, const Dlist& L) {
printf("%s \n",s.c_str());
int n = L.size();
for (int i=0; i<n; i++) printf("%5d : %.3f\n",i,L[i]);
printf("\n");
}