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


C++ list::back方法代码示例

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


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

示例1: write

void VDAVIOutputSegmentedVideoStream::write(uint32 flags, const void *pBuffer, uint32 cbBuffer, uint32 samples) {
	if (mPendingRuns.empty())
		mPendingRuns.push_back(Run());
	else if (flags & AVIIF_KEYFRAME) {
		mPendingRuns.back().mbClosed = true;
		mPendingRuns.push_back(Run());
	}

	Run& run = mPendingRuns.back();
	run.mBlocks.push_back(Block());
	run.mSize += (cbBuffer + 1) & ~1;			// evenify for AVI
	Block& block = run.mBlocks.back();

	block.data = new char[cbBuffer];
	block.size = cbBuffer;
	block.capacity = cbBuffer;
	block.flags = flags;

	memcpy(block.data, pBuffer, cbBuffer);
	++mSamplesWritten;
	++mBufferedSamples;

	run.mEndTime = VDRoundToInt64(mSamplesWritten * (1000000.0 * (double)streamInfo.dwScale / (double)streamInfo.dwRate));

	mpParent->Update();
}
开发者ID:KGE-INC,项目名称:modplus,代码行数:26,代码来源:AVIOutputSegmented.cpp

示例2: Split

void CArea::Split(std::list<CArea> &m_areas)const
{
	if(HolesLinked())
	{
		for(std::list<CCurve>::const_iterator It = m_curves.begin(); It != m_curves.end(); It++)
		{
			const CCurve& curve = *It;
			m_areas.push_back(CArea());
			m_areas.back().m_curves.push_back(curve);
		}
	}
	else
	{
		CArea a = *this;
		a.Reorder();

		if(CArea::m_please_abort)return;

		for(std::list<CCurve>::const_iterator It = a.m_curves.begin(); It != a.m_curves.end(); It++)
		{
			const CCurve& curve = *It;
			if(curve.IsClockwise())
			{
				if(m_areas.size() > 0)
					m_areas.back().m_curves.push_back(curve);
			}
			else
			{
				m_areas.push_back(CArea());
				m_areas.back().m_curves.push_back(curve);
			}
		}
	}
}
开发者ID:DevJohan,项目名称:FreeCAD_sf_master,代码行数:34,代码来源:Area.cpp

示例3: getCurrentTime

void
endProfile(trace::Call &call, bool isDraw) {
    if (retrace::profilingWithBackends) {
        if (profilingBoundaries[QUERY_BOUNDARY_CALL] ||
            profilingBoundaries[QUERY_BOUNDARY_DRAWCALL]) {
            if (curMetricBackend) {
                curMetricBackend->endQuery(isDraw ? QUERY_BOUNDARY_DRAWCALL : QUERY_BOUNDARY_CALL);
            }
        }
        return;
    }

    /* CPU profiling for all calls */
    if (retrace::profilingCpuTimes) {
        CallQuery& query = callQueries.back();
        query.cpuEnd = getCurrentTime();
    }

    /* GPU profiling only for draw calls */
    if (isDraw) {
        if (retrace::profilingGpuTimes) {
            glEndQuery(GL_TIME_ELAPSED);
        }

        if (retrace::profilingPixelsDrawn) {
            glEndQuery(GL_SAMPLES_PASSED);
        }
    }

    if (retrace::profilingMemoryUsage) {
        CallQuery& query = callQueries.back();
        query.vsizeEnd = os::getVsize();
        query.rssEnd = os::getRss();
    }
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:35,代码来源:glretrace_main.cpp

示例4: do_pickup

void Pickup::do_pickup( const tripoint &pickup_target_arg, bool from_vehicle,
                        std::list<int> &indices, std::list<int> &quantities, bool autopickup )
{
    bool got_water = false;
    int cargo_part = -1;
    vehicle *veh = nullptr;
    bool weight_is_okay = (g->u.weight_carried() <= g->u.weight_capacity());
    bool volume_is_okay = (g->u.volume_carried() <= g->u.volume_capacity());
    bool offered_swap = false;
    // Convert from player-relative to map-relative.
    tripoint pickup_target = pickup_target_arg + g->u.pos();
    // Map of items picked up so we can output them all at the end and
    // merge dropping items with the same name.
    PickupMap mapPickup;

    if( from_vehicle ) {
        int veh_root_part = -1;
        veh = g->m.veh_at( pickup_target, veh_root_part );
        cargo_part = veh->part_with_feature( veh_root_part, "CARGO", false );
    }

    while( g->u.moves >= 0 && !indices.empty() ) {
        // Pulling from the back of the (in-order) list of indices insures
        // that we pull from the end of the vector.
        int index = indices.back();
        int quantity = quantities.back();
        // Whether we pick the item up or not, we're done trying to do so,
        // so remove it from the list.
        indices.pop_back();
        quantities.pop_back();

        item *target = nullptr;
        if( from_vehicle ) {
            target = g->m.item_from( veh, cargo_part, index );
        } else {
            target = g->m.item_from( pickup_target, index );
        }

        if( target == nullptr ) {
            continue; // No such item.
        }

        pick_one_up( pickup_target, *target, veh, cargo_part, index, quantity,
                     got_water, offered_swap, mapPickup, autopickup );
    }

    if( !mapPickup.empty() ) {
        show_pickup_message(mapPickup);
    }

    if (got_water) {
        add_msg(m_info, _("You can't pick up a liquid!"));
    }
    if (weight_is_okay && g->u.weight_carried() > g->u.weight_capacity()) {
        add_msg(m_bad, _("You're overburdened!"));
    }
    if (volume_is_okay && g->u.volume_carried() > g->u.volume_capacity()) {
        add_msg(m_bad, _("You struggle to carry such a large volume!"));
    }
}
开发者ID:JasonNAwesome,项目名称:Cataclysm-DDA,代码行数:60,代码来源:pickup.cpp

示例5: create_pipe

void create_pipe(){
    static const double h_min=(DISPLAY_HEIGHT-barrier_height_range)/2.0f;
    static const double h_max=(DISPLAY_HEIGHT-(DISPLAY_HEIGHT-barrier_height_range)/2.0f)-barrier_gap;
    double height=drand(h_min,h_max);

// init upper pipe
    pipes.push_back(new my_pipe);
    pipes.back()->set_values(my_pipe::pipe_image,40+DISPLAY_WIDTH,al_get_bitmap_height(my_pipe::pipe_image)/2-height-barrier_gap,-(DISPLAY_WIDTH/barrier_lifetime),0);
    pipes.back()->has_passed=0;
    pipes.back()->is_pair_leader=1;

// init lower pipe
    pipes.push_back(new my_pipe);
    pipes.back()->set_values(my_pipe::pipe_image,40+DISPLAY_WIDTH,al_get_bitmap_height(my_pipe::pipe_image)/2+DISPLAY_HEIGHT-height,-(DISPLAY_WIDTH/barrier_lifetime),0);
    pipes.back()->has_passed=0;
    pipes.back()->is_pair_leader=0;
    menu->to_top();
    start_button->to_top();
    quit_button->to_top();
    score_string->to_top();
#ifdef NDEBUG
    tick_string->to_top();
    vel_string->to_top();
#endif
    bird->to_top();
}
开发者ID:ccapitalK,项目名称:si2e,代码行数:26,代码来源:floppy_bird.cpp

示例6: leaveScope

void Variables::leaveScope(bool insideLoop)
{
    if (insideLoop) {
        // read variables are read again in subsequent run through loop
        std::set<unsigned int> const & currentVarReadInScope = _varReadInScope.back();
        for (std::set<unsigned int>::const_iterator readIter = currentVarReadInScope.begin();
             readIter != currentVarReadInScope.end();
             ++readIter) {
            read(*readIter, nullptr);
        }
    }

    std::list<std::set<unsigned int> >::reverse_iterator reverseReadIter = _varReadInScope.rbegin();
    ++reverseReadIter;
    if (reverseReadIter != _varReadInScope.rend()) {
        // Transfer read variables into previous scope

        std::set<unsigned int> const & currentVarAddedInScope = _varAddedInScope.back();
        std::set<unsigned int>  & currentVarReadInScope = _varReadInScope.back();
        for (std::set<unsigned int>::const_iterator addedIter = currentVarAddedInScope.begin();
             addedIter != currentVarAddedInScope.end();
             ++addedIter) {
            currentVarReadInScope.erase(*addedIter);
        }
        std::set<unsigned int> & previousVarReadInScope = *reverseReadIter;
        previousVarReadInScope.insert(currentVarReadInScope.begin(),
                                      currentVarReadInScope.end());
    }
    _varReadInScope.pop_back();
    _varAddedInScope.pop_back();
}
开发者ID:barisdemiray,项目名称:cppcheck,代码行数:31,代码来源:checkunusedvar.cpp

示例7: getCurrentTime

void
endProfile(trace::Call &call, bool isDraw) {

    /* CPU profiling for all calls */
    if (retrace::profilingCpuTimes) {
        CallQuery& query = callQueries.back();
        query.cpuEnd = getCurrentTime();
    }

    /* GPU profiling only for draw calls */
    if (isDraw) {
        if (retrace::profilingGpuTimes) {
            glEndQuery(GL_TIME_ELAPSED);
        }

        if (retrace::profilingPixelsDrawn) {
            glEndQuery(GL_SAMPLES_PASSED);
        }
    }

    if (retrace::profilingMemoryUsage) {
        CallQuery& query = callQueries.back();
        query.vsizeEnd = os::getVsize();
        query.rssEnd = os::getRss();
    }
}
开发者ID:Web5design,项目名称:apitrace,代码行数:26,代码来源:glretrace_main.cpp

示例8: add_value

    inline void add_value(const string_t& _value)
    {
        assert(has_value.size());
        assert(!has_value.back());

        has_value.back() = true;
        out << ">" << _value;
    }
开发者ID:dgu123,项目名称:emf4cpp,代码行数:8,代码来源:greedy_serializer.hpp

示例9: do_pickup

void Pickup::do_pickup( point pickup_target, bool from_vehicle,
                        std::list<int> &indices, std::list<int> &quantities, bool autopickup )
{
    bool got_water = false;
    int cargo_part = -1;
    vehicle *veh = nullptr;
    bool weight_is_okay = (g->u.weight_carried() <= g->u.weight_capacity());
    bool volume_is_okay = (g->u.volume_carried() <= g->u.volume_capacity() -  2);
    bool offered_swap = false;
    // Convert from player-relative to map-relative.
    pickup_target.x += g->u.xpos();
    pickup_target.y += g->u.ypos();
    // Map of items picked up so we can output them all at the end and
    // merge dropping items with the same name.
    std::map<std::string, int> mapPickup;
    std::map<std::string, item> item_info;

    if( from_vehicle ) {
        int veh_root_part = -1;
        veh = g->m.veh_at( pickup_target.x, pickup_target.y, veh_root_part );
        cargo_part = veh->part_with_feature( veh_root_part, "CARGO", false );
    }

    std::vector<item> &here = from_vehicle ? veh->parts[cargo_part].items :
        g->m.i_at_mutable( pickup_target.x, pickup_target.y );

    // Grow here vector if needed to avoid resize operations invalidating pointers during operation.
    here.reserve( here.size() + 1 );

    while( g->u.moves >= 0 && !indices.empty() ) {
        // Pulling from the back of the (in-order) list of indices insures
        // that we pull from the end of the vector.
        int index = indices.back();
        int quantity = quantities.back();
        // Whether we pick the item up or not, we're done trying to do so,
        // so remove it from the list.
        indices.pop_back();
        quantities.pop_back();

        pick_one_up( pickup_target, here[index], veh, cargo_part, index, quantity,
                     got_water, offered_swap, mapPickup, item_info, autopickup );
    }

    if( !mapPickup.empty() ) {
        show_pickup_message(mapPickup, item_info);
    }

    if (got_water) {
        add_msg(m_info, _("You can't pick up a liquid!"));
    }
    if (weight_is_okay && g->u.weight_carried() >= g->u.weight_capacity()) {
        add_msg(m_bad, _("You're overburdened!"));
    }
    if (volume_is_okay && g->u.volume_carried() > g->u.volume_capacity() - 2) {
        add_msg(m_bad, _("You struggle to carry such a large volume!"));
    }
}
开发者ID:Abbysynth,项目名称:Cataclysm-DDA,代码行数:57,代码来源:pickup.cpp

示例10: delkey

void delkey(HANDLE hCalc){
	if (!button_list.empty()){
	UINT style = GetWindowLong(button_list.back(),GWL_STYLE);
				style &= ~WS_VISIBLE;
				SetWindowLong(button_list.back(),GWL_STYLE,style);
				//UpdateWindow((HWND)hCalc);
				SendMessage((HWND)hCalc,WM_PAINT,0,0);
				button_list.pop_back();
	}
}
开发者ID:shpakitze,项目名称:winapi,代码行数:10,代码来源:homework_2(5).cpp

示例11: reset

 void reset()
 {
     while (!active.empty()) {
         delete active.back();
         active.pop_back();
     }
     while (!inactive.empty()) {
         delete inactive.back();
         inactive.pop_back();
     }
 }
开发者ID:jgvictores,项目名称:yarp,代码行数:11,代码来源:PortReaderBufferBase.cpp

示例12: rotateZ

void MultitouchNavigation::rotateZ(const std::list<TouchContact> &contacts)
{
    // get current screen position of finger
    osg::Vec3d curr3DVec1(contacts.front().x, cover->frontWindowVerticalSize - contacts.front().y, 0.);
    osg::Vec3d curr3DVec2(contacts.back().x, cover->frontWindowVerticalSize - contacts.back().y, 0.);

    if (_counter > 0)
    {
        // figure out rotation
        osg::Vec3d lineCurrCurr = osg::Vec3d(curr3DVec1.x(), curr3DVec1.y(), 1.0) ^ osg::Vec3d(curr3DVec2.x(), curr3DVec2.y(), 1.0);
        osg::Vec3d linePrevPrev = osg::Vec3d(_prev3DVec1.x(), _prev3DVec1.y(), 1.0) ^ osg::Vec3d(_prev3DVec2.x(), _prev3DVec2.y(), 1.0);
        osg::Vec3d interception = lineCurrCurr ^ linePrevPrev;
        if (interception.z() != 0.)
        {
            double x = interception.x() / interception.z();
            double y = interception.y() / interception.z();

            // calculate ModelView - Projection - Window Transformation
            osg::Camera *cam = coVRConfig::instance()->channels[0].camera;
            osg::Matrix MVPW(cam->getViewMatrix() * cam->getProjectionMatrix() * cam->getViewport()->computeWindowMatrix());
            osg::Matrixd inverseMVPW = osg::Matrixd::inverse(MVPW);
            // determine z-plane of Xform in screen coordinates
            osg::Vec3d XformTranslation2D = cover->getXformMat().getTrans() * MVPW;
            // rotation center in Xform coordinates
            osg::Vec3d currentVector3D(x, y, XformTranslation2D.z());
            currentVector3D = currentVector3D * inverseMVPW;

            // calculate angle & axis
            double angle = angleBetween3DVectors((_prev3DVec1 - _prev3DVec2), (curr3DVec1 - curr3DVec2));
            osg::Vec3d axis = cover->getViewerMat().getTrans() - currentVector3D;
            osg::Vec3d sign = (_prev3DVec1 - _prev3DVec2) ^ (curr3DVec1 - curr3DVec2);
            sign.normalize();
            axis.x() = axis.x() * sign.z();
            axis.y() = axis.y() * sign.z();
            axis.z() = axis.z() * sign.z();
            osg::Quat delta = osg::Quat(angle, axis);

            // create copy of XformMat for calculation
            osg::Matrixd Xform = cover->getXformMat();
            // translate coordinate system to center of line
            Xform.postMultTranslate(-currentVector3D);
            // rotate
            Xform.postMultRotate(delta);
            // translate back to origin
            Xform.postMultTranslate(currentVector3D);
            // set XformMat to copy
            cover->setXformMat(Xform);
        }
    }

    _prev3DVec1 = curr3DVec1;
    _prev3DVec2 = curr3DVec2;
    _counter++;
}
开发者ID:dwickeroth,项目名称:covise,代码行数:54,代码来源:MultitouchNavigation.cpp

示例13: add

	void add(int value)
	{
		if(inRep)
			tmp.push_back(value);
		else
		{
			// add 'value' here.
			nodes.push_back(CNode());
			nodes.back().value = value;
			root->children.push_back(&nodes.back());
		}
	}
开发者ID:huffman,项目名称:CRUDASM7,代码行数:12,代码来源:testbuildc.cpp

示例14: Disconnect

void Constraint::Disconnect(std::list<HeeksObj*> parents)
{
	HeeksObj* owner = GetFirstOwner();
	if(parents.back() == owner)
	{
		this->RemoveOwner(owner);
		return;
	}
	owner = GetNextOwner();
	if(parents.back() == owner)
		RemoveOwner(owner);
}
开发者ID:DavidNicholls,项目名称:heekscad,代码行数:12,代码来源:Constraint.cpp

示例15: algorithm_nearestFit

	void Identifier::algorithm_nearestFit(std::list<Frame> & frames)
	{
		Frame * current = &frames.front();
		Frame * previous = &(*(++frames.begin()));
		
		static std::list<std::list<Error>> errorMapping;
		static std::vector<std::list<std::list<Error>::iterator>> errorMapIterators;
		errorMapping.clear();
		errorMapIterators.clear();

		float distanceError, areaError, error;
		std::list<Error>::iterator errorMapIteratorIterator;
		std::list<std::list<Error>>::iterator errorMapIterator;
		int pIndex;
		for(std::vector<Object>::iterator c = current->objects.begin(); c != current->objects.end(); c++)
		{
			errorMapIterator = errorMapping.insert(errorMapping.end(), std::list<Error>());
			errorMapIterators.push_back(std::list<std::list<Error>::iterator>());
			pIndex = 0;
			for(std::vector<Object>::iterator p = previous->objects.begin(); p != previous->objects.end(); p++)
			{
				distanceError = std::pow(c->x - p->x - p->dx, 2) + std::pow(c->y - p->y - p->dy, 2);
				error = distanceError;

				errorMapIteratorIterator = errorMapping.back().insert(errorMapping.back().end(),Error(&(*p), &(*c), pIndex, error));
				errorMapIterators[pIndex].push_back(errorMapIteratorIterator);
				pIndex++;
			}
			errorMapping.back().sort();
		}

		for(int i = 0; i < std::min(current->objects.size(), previous->objects.size()); i++)
		{
			errorMapping.sort();
			errorMapping.front().front().current->id = errorMapping.front().front().previous->id;
			errorMapping.front().front().current->model = errorMapping.front().front().previous->model;
			errorMapping.front().front().current->isDecided = true;
			
			while(it != errorMapIterator->end())
				.erase(it)
			
		}

		for(std::vector<Object>::iterator c = current->objects.begin(); c != current->objects.end(); c++)
		{
			if(!c->isDecided)
				c->id = newID();
		}

		

	}
开发者ID:BabyFlower,项目名称:Tracking,代码行数:52,代码来源:Identification+-+Copy.cpp


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