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


C++ Cont::push_back方法代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:estnltk,项目名称:estnltk-vislcg3,代码行数:26,代码来源:inlines.hpp

示例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;
}
开发者ID:OlexandrSavchuk,项目名称:cpp-lessons,代码行数:28,代码来源:cmpContainers.cpp

示例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;
 }
开发者ID:Telecommunication-Telemedia-Assessment,项目名称:V-BMS360,代码行数:12,代码来源:udemy_course_test.cpp

示例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);
    } 
}
开发者ID:mdaughtrey,项目名称:personal-projects,代码行数:40,代码来源:main.cpp

示例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;
}
开发者ID:OlexandrSavchuk,项目名称:cpp-lessons,代码行数:22,代码来源:cmpContainers.cpp

示例6: operator

 void operator()() const
 {
     cont->push_back(argument_type());
 }
开发者ID:fullstackenviormentss,项目名称:sbmt,代码行数:4,代码来源:push_backer.hpp

示例7: operator

 void operator()(Cont& c, long count) {
     for (long i = 0; i < count; i++)
         c.push_back(fs);
 }
开发者ID:finalx,项目名称:finalx-labs-all,代码行数:4,代码来源:SequencePerformance.cpp

示例8:

 Back_inserter& operator=(typename Cont::const_reference val) { c->push_back(val); return *this; }
开发者ID:Nobody-7,项目名称:tcpppl_answers,代码行数:1,代码来源:ex05.cpp


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