本文整理汇总了C++中Cont::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Cont::push_back方法的具体用法?C++ Cont::push_back怎么用?C++ Cont::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cont
的用法示例。
在下文中一共展示了Cont::push_back方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GAppSetOpts_ranged
inline void GAppSetOpts_ranged(const char *value, Cont& cont) {
cont.clear();
bool had_range = false;
const char *comma = value;
do {
uint32_t low = abs(atoi(comma)), high = low;
const char *delim = strchr(comma, '-');
const char *nextc = strchr(comma, ',');
if (delim && (nextc == 0 || nextc > delim)) {
had_range = true;
high = abs(atoi(delim + 1));
}
for (; low <= high; ++low) {
cont.push_back(low);
}
} while ((comma = strchr(comma, ',')) != 0 && ++comma && *comma != 0);
if (cont.size() == 1 && !had_range) {
uint32_t val = cont.front();
cont.clear();
for (uint32_t i = 1; i <= val; ++i) {
cont.push_back(i);
}
}
}
示例2: insert_back
void insert_back(Cont& c, long& avg, const int& num_op)
{
cout << "\nCounting..."
<< "time of " << num_op << " back_insert";
clock_t t = 0;
for(int j = 0; j < REPEAT_TEST; ++j)
{
c.push_back(0);
c.push_back(0);
auto it = c.end();
t = clock();
for (int i = 1; i <= num_op ; ++i)
{
it = c.end();
c.insert(it, i);
}
t = clock() - t;
avg += t;
c.clear();
}
avg /= REPEAT_TEST;
}
示例3: keep_if
Cont keep_if(Pred pred, const Cont& xs)
{
Cont ys;
for (const auto x : xs)
{
if (pred(x))
{
ys.push_back(x);
}
}
return ys;
}
示例4: strategy1
void strategy1()
{
int numElems;
cin >> numElems;
Cont container;
for (int ii = 0; ii < numElems; ii++)
{
container.push_back(0);
cin >> container.back();
}
for (int day = 0; ; day++)
{
list<ContIter> toDelete;
ContIter iThis(container.begin());
ContIter iPrev(iThis);
iThis++;
while (iThis != container.end())
{
if (*iThis > *iPrev)
{
toDelete.push_back(iThis);
}
iThis++;
iPrev++;
}
if (toDelete.empty())
{
cout << day << endl;
break;
}
// cout << "toDelete ";
// dump(toDelete);
for (list<ContIter>::reverse_iterator iDel = toDelete.rbegin(); iDel != toDelete.rend(); iDel++)
{
container.erase(*iDel);
}
// dump(container);
}
}
示例5: push_back
void push_back(Cont& c, long& avg, const int& num_op)
{
cout << "\nCounting..."
<< "time of " << num_op << " push_back";
clock_t t = 0;
for(int j = 0; j < REPEAT_TEST; ++j)
{
t = clock();
for (int i = 1; i <= num_op ; ++i)
{
c.push_back(i);
}
t = clock() - t;
avg += t;
c.clear();
}
c.clear();
avg /= REPEAT_TEST;
}
示例6: operator
void operator()() const
{
cont->push_back(argument_type());
}
示例7: operator
void operator()(Cont& c, long count) {
for (long i = 0; i < count; i++)
c.push_back(fs);
}
示例8:
Back_inserter& operator=(typename Cont::const_reference val) { c->push_back(val); return *this; }