本文整理汇总了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();
}
示例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);
}
}
}
}
示例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();
}
}
示例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!"));
}
}
示例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();
}
示例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();
}
示例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();
}
}
示例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;
}
示例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!"));
}
}
示例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();
}
}
示例11: reset
void reset()
{
while (!active.empty()) {
delete active.back();
active.pop_back();
}
while (!inactive.empty()) {
delete inactive.back();
inactive.pop_back();
}
}
示例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++;
}
示例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());
}
}
示例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);
}
示例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();
}
}