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


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

本文整理汇总了C++中container::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ container::push_back方法的具体用法?C++ container::push_back怎么用?C++ container::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在container的用法示例。


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

示例1: checktest13

void checktest13(unsigned long timer)
{
    if (timer==500)
    {
        //dMatrix3 R;
        //ray = dCreateRay(space,4000.0f);
        //dGeomSetPosition(ray,1000.0f,20.5f,-4000.0f);   // 0 20 -4000
        //dRFromAxisAndAngle (R,0.0f,1.0f,0.0f,-90.0f);
        //dGeomSetRotation (ray,R);

        LaserTurret *l=(LaserTurret*)entities[1];
        l->inclination = 0.5;
        Vehicle *action = (l)->fire(world,space);
        //int *idx = new int();
        //*idx = vehicles.push_back(action);
        //dBodySetData( action->getBodyID(), (void*)idx);
        if (action != NULL)
        {
            entities.push_back(action);
            gunshot();
        }

    }

    if (timer == 700)
    {
        Vehicle *_b = entities[0];

        if (_b->getHealth() == 1000.0f)
        {
            printf("Test failed: The laser did nothing to the Carrier.\n");
            endWorldModelling();
            exit(-1);

        } else {
            printf("Test passed OK!\n");
            endWorldModelling();
            exit(1);
        }

    }

}
开发者ID:faturita,项目名称:wakuseibokan,代码行数:43,代码来源:testbox.cpp

示例2: test2

void test2()
{
    SimplifiedDynamicManta *_manta1 = new SimplifiedDynamicManta(GREEN_FACTION);

    _manta1->init();
    _manta1->embody(world, space);
    _manta1->setPos(0.0f,20.5f,-6000.0f);
    _manta1->setStatus(0);
    _manta1->inert = true;
    _manta1->setStatus(Manta::FLYING);
    _manta1->elevator = +12;
    struct controlregister c;
    c.thrust = 1500.0f/(-10.0);
    c.pitch = 12;
    _manta1->setControlRegisters(c);
    _manta1->setThrottle(1500.0f);

    entities.push_back(_manta1);
}
开发者ID:faturita,项目名称:wakuseibokan,代码行数:19,代码来源:testbox.cpp

示例3: push_back

	static void push_back(container& co, const T& val) {
		co.push_back(val);
	}
开发者ID:fluxdark,项目名称:jflib,代码行数:3,代码来源:container.hpp

示例4:

	BigData(unsigned char exponent){
		data.reserve(exponent);
		for (unsigned char i = 0; i < exponent; i++)
			data.push_back(0);
		data.push_back(1);
	}
开发者ID:VladyslavYefremov,项目名称:PrometheusAlgorithms,代码行数:6,代码来源:karatsuba-algorithm.cpp

示例5: checktest10

void checktest10(unsigned long timer)
{
    static unsigned long timerstep = 0;
    Walrus *_walrus = (Walrus*)entities[1];

    static int stateMachine = 0;

    if (timer == 100)
    {
        _walrus->enableAuto();
        struct controlregister c;
        c.thrust = 0.0f;
        c.roll = 20.0f;
        _walrus->setControlRegisters(c);
    }


    if (timer == 275)
    {
        _walrus->enableAuto();
        struct controlregister c;
        c.thrust = 0.0f;
        c.roll = 0.0f;
        _walrus->setControlRegisters(c);
        _walrus->stop();
    }

    if (timer == 300)
    {

        _walrus->enableAuto();
        struct controlregister c;
        c.thrust = 200.0f;
        c.roll = -1;
        _walrus->setControlRegisters(c);
        _walrus->setThrottle(200.0f);
    }

    if (stateMachine == 0 && _walrus->getStatus()==Walrus::ROLLING)
    {
        timerstep = timer;
        stateMachine = 1;
    }

    if (stateMachine == 1 && timerstep>0 && timer == (timerstep + 50))
    {
        struct controlregister c;
        c.thrust = 0.0f;
        c.roll = 0;
        _walrus->setControlRegisters(c);
        _walrus->setThrottle(0.0f);
        _walrus->stop();

        timerstep = timer;
        stateMachine = 2;
    }

    if (stateMachine == 2 && timerstep>0 && timer == (timerstep + 150))
    {
        BoxIsland *island = _walrus->getIsland();
        int x = (rand() % 2000 + 1); x -= 1000;
        int z = (rand() % 2000 + 1); z -= 1000;

        Structure *s = island->addStructure(new CommandCenter(GREEN_FACTION),x,z,space,world);
        entities.push_back(s);

        timerstep = timer;
        stateMachine = 3;
    }

    if (stateMachine == 3 && timerstep>0 && timer == (timerstep + 100))
    {
        CommandCenter *c = findCommandCenter(islands[0]);

        if (!c)
        {
            printf("Test failed: CommandCenter was not built on the island.\n");
            endWorldModelling();
            exit(-1);

        } else {
            printf("Test passed OK!\n");
            endWorldModelling();
            exit(1);
        }

    }


}
开发者ID:faturita,项目名称:wakuseibokan,代码行数:90,代码来源:testbox.cpp

示例6: test4

void test4()
{
    entities.push_back(islands[0]->addStructure(new Runway(GREEN_FACTION)     ,           0.0f,    0.0f,space,world));
    entities.push_back(islands[0]->addStructure(new Hangar(GREEN_FACTION)     ,        -550.0f,    0.0f,space,world));
}
开发者ID:faturita,项目名称:wakuseibokan,代码行数:5,代码来源:testbox.cpp

示例7: test3

void test3()
{
    entities.push_back(islands[0]->addStructure(new Structure()  ,           0.0f,-1000.0f,space,world));
}
开发者ID:faturita,项目名称:wakuseibokan,代码行数:4,代码来源:testbox.cpp


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