// header
#pragma once
#include <set>
usingnamespace std;
struct DrawReqCompare{
booloperator()( int A, int B );
};
class cDrawSys
{
public:
void RenderFunc();
void ToDraw( int val );
void UpdatedLvl( int val );
void RemoveFromDraw( int val );
private:
typedef std::multiset< int , DrawReqCompare() > DrawReqSet;
DrawReqSet wDrawReqSet;
};
//source
#include "multiset.h"
bool
DrawReqCompare::operator()( int A, int B ){
return A < B; }
void
cDrawSys::RenderFunc()
{
DrawReqSet::iterator
It = wDrawReqSet.begin(),
End = wDrawReqSet.end();
for( ; It != End; ++It )
(*It);
}
void
cDrawSys::ToDraw(
int val )
{
wDrawReqSet.insert( val );
}
void
cDrawSys::UpdatedLvl(
int val )
{
RemoveFromDraw( val );
ToDraw( val );
}
void
cDrawSys::RemoveFromDraw(
int val )
{
DrawReqSet::iterator
FindIt = wDrawReqSet.find( val );
// If object does not exist on map, return and take no action
if( FindIt == wDrawReqSet.end() )
return;
wDrawReqSet.erase( FindIt );
}
xtree(49) warning c4180: qualifier applied to function type has no meaning
xtree(625) error c2091: function returns function