本文整理汇总了C++中xr_vector::end方法的典型用法代码示例。如果您正苦于以下问题:C++ xr_vector::end方法的具体用法?C++ xr_vector::end怎么用?C++ xr_vector::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xr_vector
的用法示例。
在下文中一共展示了xr_vector::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
std::pair<u32,u32> get_id( const xr_vector<xrMU_Model*>& mu_models, const T * v )
{
u32 face_id = u32(-1);
struct find
{
const T * _v;
u32& _id;
find( const T * v, u32& id) : _v(v), _id( id )
{}
bool operator () ( const xrMU_Model * m )
{
VERIFY(m);
u32 id = m->find( _v );
if( id == u32(-1) )
return false;
_id = id;
return true;
}
} f( v, face_id );
xr_vector<xrMU_Model*> :: const_iterator ii =std::find_if( mu_models.begin(), mu_models.end(), f );
if( ii == mu_models.end() )
return std::pair<u32,u32>(u32(-1), u32(-1));
return std::pair<u32,u32>(u32(ii-mu_models.begin()), face_id );
}
示例2:
void CLevelChanger::net_Destroy ()
{
inherited ::net_Destroy ();
xr_vector<CLevelChanger*>::iterator it = std::find(g_lchangers.begin(), g_lchangers.end(), this);
if(it != g_lchangers.end())
g_lchangers.erase(it);
}
示例3: highlight_ammo_for_weapon
void CUIActorMenu::highlight_ammo_for_weapon( PIItem weapon_item, CUIDragDropListEx* ddlist )
{
VERIFY( weapon_item );
VERIFY( ddlist );
static xr_vector<shared_str> ammo_types;
ammo_types.clear_not_free();
CWeapon* weapon = smart_cast<CWeapon*>(weapon_item);
if ( !weapon )
{
return;
}
ammo_types.assign( weapon->m_ammoTypes.begin(), weapon->m_ammoTypes.end() );
CWeaponMagazinedWGrenade* wg = smart_cast<CWeaponMagazinedWGrenade*>(weapon_item);
if ( wg )
{
if ( wg->IsGrenadeLauncherAttached() && wg->m_ammoTypes2.size() )
{
ammo_types.insert( ammo_types.end(), wg->m_ammoTypes2.begin(), wg->m_ammoTypes2.end() );
}
}
if ( ammo_types.size() == 0 )
{
return;
}
xr_vector<shared_str>::iterator ite = ammo_types.end();
u32 const cnt = ddlist->ItemsCount();
for ( u32 i = 0; i < cnt; ++i )
{
CUICellItem* ci = ddlist->GetItemIdx(i);
PIItem item = (PIItem)ci->m_pData;
if ( !item )
{
continue;
}
CWeaponAmmo* ammo = smart_cast<CWeaponAmmo*>(item);
if ( !ammo )
{
highlight_addons_for_weapon( weapon_item, ci );
continue; // for i
}
shared_str const& ammo_name = item->object().cNameSect();
xr_vector<shared_str>::iterator itb = ammo_types.begin();
for ( ; itb != ite; ++itb )
{
if ( ammo_name._get() == (*itb)._get() )
{
ci->m_select_armament = true;
break; // itb
}
}
}//for i
}
示例4: clear_build_textures_surface
void xrLC_GlobalData::clear_build_textures_surface( const xr_vector<u32> &exept )
{
clLog( "mem usage before clear build textures surface: %u", Memory.mem_usage() );
xr_vector<b_BuildTexture>::iterator i = textures().begin();
xr_vector<b_BuildTexture>::const_iterator e = textures().end();
xr_vector<b_BuildTexture>::const_iterator b = textures().begin();
for(;i!=e;++i)
{
xr_vector<u32>::const_iterator ff = std::find( exept.begin(), exept.end(),u32( i - b ) );
if( ff == exept.end() )
::clear((*i));
}
Memory.mem_compact();
clLog( "mem usage after clear build textures surface: %u", Memory.mem_usage() );
}
示例5: vec_spetial_clear
void vec_spetial_clear( xr_vector<T> &v )
{
typename xr_vector<T>::iterator i = v.begin(), e = v.end();
for(;i!=e;++i)
clear(*i);
v.clear();
}
示例6: vec_clear
void vec_clear( xr_vector<T*> &v )
{
typename xr_vector<T*>::iterator i = v.begin(), e = v.end();
for(;i!=e;++i)
xr_delete(*i);
v.clear();
}
示例7: dump_list_wnd
void dump_list_wnd(){
Msg("------Total wnds %d",dbg_list_wnds.size());
xr_vector<DBGList>::iterator _it = dbg_list_wnds.begin();
for(;_it!=dbg_list_wnds.end();++_it)
if(!(*_it).closed)
Msg("--leak detected ---- wnd = %d",(*_it).num);
}
示例8: PlaceData
u32 PlaceData(xr_vector<vecW> &C, vecW &P)
{
if (P.size()>1) {
std::sort (P.begin(),P.end());
vecW::iterator I = std::unique (P.begin(),P.end());
P.erase(I,P.end());
}
// Search placeholder
u32 sz = P.size();
u32 pos = 0;
for (xr_vector<vecW>::iterator it=C.begin(); it!=C.end(); it++)
{
u32 S = it->size();
if (S!=sz) { pos+=S+1; continue; }
if (0!=memcmp(it->begin(),P.begin(),S*sizeof(u16))) { pos+=S+1; continue; }
// Ok-Ob :)
goto exit;
}
// If we get here - need to register _new set of data
C.push_back(P);
exit:
P.clear();
return pos*sizeof(u16);
}
示例9: GetParent
CUIWindow::~CUIWindow()
{
VERIFY( !(GetParent()&&IsAutoDelete()) );
CUIWindow* parent = GetParent();
bool ad = IsAutoDelete();
if( parent && !ad )
parent->CUIWindow::DetachChild( this );
DetachAll();
if( GetPPMode() )
MainMenu()->UnregisterPPDraw (this);
#ifdef LOG_ALL_WNDS
xr_vector<DBGList>::iterator _it = dbg_list_wnds.begin();
bool bOK = false;
for(;_it!=dbg_list_wnds.end();++_it){
if( (*_it).num==m_dbg_id && !(*_it).closed){
bOK = true;
(*_it).closed = true;
dbg_list_wnds.erase(_it);
break;
}
if( (*_it).num==m_dbg_id && (*_it).closed){
Msg("--CUIWindow [%d] already deleted", m_dbg_id);
bOK = true;
}
}
if(!bOK)
Msg("CUIWindow::~CUIWindow.[%d] cannot find window in list", m_dbg_id);
#endif
}
示例10:
void CallFunctions (xr_vector<luabind::functor<void> >& v)
{
xr_vector<luabind::functor<void> >::iterator it = v.begin();
for(;it!=v.end();++it){
if( (*it).is_valid() ) (*it)();
}
}
示例11: SaveDATA
void SaveDATA(IWriter &fs, xr_vector<vecW> &C)
{
for (xr_vector<vecW>::iterator it=C.begin(); it!=C.end(); it++)
{
fs.Wword(it->size());
fs.write(it->begin(),it->size()*sizeof(u16));
}
}
示例12: vfOptimizeParameters
void vfOptimizeParameters(xr_vector<xr_vector<REAL> > &A, xr_vector<xr_vector<REAL> > &B, xr_vector<REAL> &C, xr_vector<REAL> &D, REAL dEpsilon, REAL dAlpha, REAL dBeta, REAL dNormaFactor, u32 dwMaxIterationCount)
{
u32 dwTestCount = (u32)B.size();
xr_vector<REAL> daGradient;
xr_vector<REAL> daDelta;
xr_vector<xr_vector<REAL> > daEvalResults; daEvalResults.resize(dwTestCount);
if (!B.size()) {
clMsg ("! ERROR : there are no parameters to fit!");
return;
}
u32 dwParameterCount = (u32)B[0].size();
C.assign (dwParameterCount,1.0f);
D.assign (dwParameterCount,0.0f);
daDelta.assign (dwParameterCount,0);
daGradient.assign (dwParameterCount,0);
{
for (u32 i=0; i<dwTestCount; i++)
daEvalResults[i].resize(dwParameterCount);
}
u32 i = 0;
REAL dFunctional = dfComputeEvalResults(daEvalResults,A,B,C,D), dPreviousFunctional;
//clMsg ("* MU-fitter: %6d : %17.8f (%17.8f)",i,dFunctional,dFunctional/dwTestCount);
do {
dPreviousFunctional = dFunctional;
dafGradient (daEvalResults, daGradient, B, dNormaFactor);
std::transform (daGradient.begin(), daGradient.end(), daGradient.begin(), std::bind2nd(std::multiplies<REAL>(), -dAlpha));
std::transform (daDelta.begin(), daDelta.end(), daDelta.begin(), std::bind2nd(std::multiplies<REAL>(), dBeta));
std::transform (daGradient.begin(), daGradient.end(), daDelta.begin(), daDelta.begin(), std::plus<REAL>());
std::transform (C.begin(), C.end(), daDelta.begin(), C.begin(), std::plus<REAL>());
std::transform (D.begin(), D.end(), daDelta.begin(), D.begin(), std::plus<REAL>());
dFunctional = dfComputeEvalResults(daEvalResults,A,B,C,D);
i++;
}
while ((((dPreviousFunctional - dFunctional)/dwTestCount) > dEpsilon) && (i <= dwMaxIterationCount));
if (dPreviousFunctional < dFunctional) {
std::transform (daDelta.begin(), daDelta.end(), daDelta.begin(), std::bind2nd(std::multiplies<REAL>(), -1));
std::transform (C.begin(), C.end(), daDelta.begin(), C.begin(), std::plus<REAL>());
std::transform (D.begin(), D.end(), daDelta.begin(), D.begin(), std::plus<REAL>());
}
dFunctional = dfComputeEvalResults(daEvalResults,A,B,C,D);
//clMsg ("* MU-fitter: %6d : %17.8f (%17.8f)",i,dFunctional,dFunctional/dwTestCount);
}
示例13:
BOOL reclaim (xr_vector<T*>& vec, const T* ptr)
{
xr_vector<T*>::iterator it = vec.begin ();
xr_vector<T*>::iterator end = vec.end ();
for (; it!=end; it++)
if (*it == ptr) { vec.erase (it); return TRUE; }
return FALSE;
}
示例14: if
void sort_tlist_mat
(
xr_vector<mapMatrixTextures::TNode*,render_alloc<mapMatrixTextures::TNode*> >& lst,
xr_vector<mapMatrixTextures::TNode*,render_alloc<mapMatrixTextures::TNode*> >& temp,
mapMatrixTextures& textures,
BOOL bSSA
)
{
int amount = textures.begin()->key->size();
if (bSSA)
{
if (amount<=1)
{
// Just sort by SSA
textures.getANY_P (lst);
std::sort (lst.begin(), lst.end(), cmp_textures_ssa_mat);
}
else
{
// Split into 2 parts
mapMatrixTextures::TNode* _it = textures.begin ();
mapMatrixTextures::TNode* _end = textures.end ();
for (; _it!=_end; _it++) {
if (_it->val.ssa > r_ssaHZBvsTEX) lst.push_back (_it);
else temp.push_back (_it);
}
// 1st - part - SSA, 2nd - lexicographically
std::sort (lst.begin(), lst.end(), cmp_textures_ssa_mat);
if (2==amount) std::sort (temp.begin(), temp.end(), cmp_textures_lex2_mat);
else if (3==amount) std::sort (temp.begin(), temp.end(), cmp_textures_lex3_mat);
else std::sort (temp.begin(), temp.end(), cmp_textures_lexN_mat);
// merge lists
lst.insert (lst.end(),temp.begin(),temp.end());
}
}
else
{
textures.getANY_P (lst);
if (2==amount) std::sort (lst.begin(), lst.end(), cmp_textures_lex2_mat);
else if (3==amount) std::sort (lst.begin(), lst.end(), cmp_textures_lex3_mat);
else std::sort (lst.begin(), lst.end(), cmp_textures_lexN_mat);
}
}
示例15: Perform_connect_spawn
void xrServer::Perform_connect_spawn(CSE_Abstract* E, xrClientData* CL, NET_Packet& P)
{
xr_vector<u16>::iterator it = std::find(g_perform_spawn_ids.begin(), g_perform_spawn_ids.end(), E->ID);
if(it!=g_perform_spawn_ids.end())
return;
g_perform_spawn_ids.push_back(E->ID);
if (E->net_Processed) return;
if (E->s_flags.is(M_SPAWN_OBJECT_PHANTOM)) return;
// Connectivity order
CSE_Abstract* Parent = ID_to_entity (E->ID_Parent);
if (Parent) Perform_connect_spawn (Parent,CL,P);
// Process
Flags16 save = E->s_flags;
//-------------------------------------------------
E->s_flags.set (M_SPAWN_UPDATE,TRUE);
if (0==E->owner)
{
// PROCESS NAME; Name this entity
if (E->s_flags.is(M_SPAWN_OBJECT_ASPLAYER))
{
CL->owner = E;
E->set_name_replace (*CL->name);
}
// Associate
E->owner = CL;
E->Spawn_Write (P,TRUE );
E->UPDATE_Write (P);
}
else
{
// Just inform
E->Spawn_Write (P,FALSE);
E->UPDATE_Write (P);
}
//-----------------------------------------------------
E->s_flags = save;
SendTo (CL->ID,P,net_flags(TRUE,TRUE));
E->net_Processed = TRUE;
}