本文整理汇总了C++中std::deque::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ deque::push_back方法的具体用法?C++ deque::push_back怎么用?C++ deque::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::deque
的用法示例。
在下文中一共展示了deque::push_back方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
MovementCommand &AllocateMovementCommand( void ) {
//FIXME: calculate ~1s worth of input?
if ( movementCmds.size() >= 10 ) {
movementCmds.pop_front();
//FIXME: does this call destructor on pointer elements?
}
MovementCommand newCmd = {};
movementCmds.push_back( newCmd );
return movementCmds.back();
}
示例2: Aquire
TSRTexture* TSRTextureManager::Aquire( const char* _pResourceName, eDefaultTextureType _typeHint, bool _bLoadImmediately )
{
string Key = _pResourceName;
if ( m_ResourcesMap.find( Key ) != m_ResourcesMap.end() )
{
sResourceEntry& entry = m_ResourcesMap[ Key ];
entry.m_NumUsers++;
return entry.m_pResource;
}
/// unlock this line to stream textures
_bLoadImmediately = true;
if ( _bLoadImmediately )
{
// if not found..create a new entry
sResourceEntry newEntry;
newEntry.m_pResource = new TSRTexture( _pResourceName );
newEntry.m_NumUsers = 1;
m_ResourcesMap[ Key ] = newEntry;
return newEntry.m_pResource;
}
else
{
// if not found..create a new entry
sResourceEntry newEntry;
newEntry.m_pResource = new TSRTexture();
newEntry.m_NumUsers = 1;
switch ( _typeHint )
{
case DefaultTexture_Black:
newEntry.m_pResource->m_pWrapped = m_pBlackTexture->m_pWrapped;
break;
case DefaultTexture_Normal:
newEntry.m_pResource->m_pWrapped = m_pDefaultNormalTexture->m_pWrapped;
break;
default:
newEntry.m_pResource->m_pWrapped = m_pWhiteTexture->m_pWrapped;
break;
}
m_ResourcesMap[ Key ] = newEntry;
/// add a new request to the queue
sTextureLoadRequest newRequest;
newRequest.m_pTextureToLoad = newEntry.m_pResource;
newRequest.m_strFileName = _pResourceName;
g_TextureLoadRequests.push_back( newRequest );
return newEntry.m_pResource;
}
}
示例3: Command
bool TorControlConnection::Command(const std::string &cmd, const ReplyHandlerCB& reply_handler)
{
if (!b_conn)
return false;
struct evbuffer *buf = bufferevent_get_output(b_conn);
if (!buf)
return false;
evbuffer_add(buf, cmd.data(), cmd.size());
evbuffer_add(buf, "\r\n", 2);
reply_handlers.push_back(reply_handler);
return true;
}
示例4: loadCaptureInfo
void loadCaptureInfo(std::deque<Capture> &captures,
const std::string &capturesFileName)
{
std::ifstream capturesFile(capturesFileName);
if (capturesFile) {
int actionType;
sf::Int32 captureTime;
while (capturesFile >> actionType >> captureTime) {
captures.push_back(std::make_pair(actionType, captureTime));
}
} else {
示例5: enque
void enque(value_type const q)
{
{
libmaus2::parallel::ScopePosixSpinLock llock(lock);
Q.push_back(q);
}
semaphore.post();
if ( parent )
parent->enque(q);
}
示例6: gputask_Kick
void gputask_Kick()
{
if(!g_gpuTasks.empty())
{
auto ptr = g_gpuTasks.front();
g_gpuTasks.pop_front();
if(ptr->m_submit) ptr->m_submit();
if(ptr->m_complete)
g_kickedTasks.push_back(ptr);
}
}
示例7: setup
void setup()
{
while ( next < V.size() && freemem >= V[next]->directSortSpace() )
{
freemem -= V[next]->directSortSpace();
pending.push_back(next);
next += 1;
}
uint64_t const p = pending.size();
for ( uint64_t i = 0; i < p; ++i )
P.post();
}
示例8: Aintelligence
static void load_ia(std::deque<AObject*> &map, std::vector<int> &m_vector)
{
std::deque<AObject*>::iterator it;
map.push_back(new Aintelligence(m_vector[POSX], m_vector[POSY], IA));
it = map.end();
--it;
dynamic_cast<Player*>(*it)->setNbBomb((int)m_vector[BOMB_NB]);
dynamic_cast<Player*>(*it)->setTotBomb((int)m_vector[BOMB_MAX]);
dynamic_cast<Player*>(*it)->setSpeed((int)m_vector[SPEED]);
dynamic_cast<Player*>(*it)->setRange((int)m_vector[RANGE]);
}
示例9: getVariablesInfo
void SDCFsiSolver::getVariablesInfo(
std::deque<int> & dof,
std::deque<bool> & enabled,
std::deque<std::string> & names
)
{
std::deque<int> dofFluid, dofSolid;
std::deque<bool> enabledFluid, enabledSolid;
std::deque<std::string> namesFluid, namesSolid;
fluid->getVariablesInfo( dofFluid, enabledFluid, namesFluid );
solid->getVariablesInfo( dofSolid, enabledSolid, namesSolid );
assert( dofFluid.size() == enabledFluid.size() );
assert( dofFluid.size() == namesFluid.size() );
assert( dofSolid.size() == enabledSolid.size() );
assert( dofSolid.size() == namesSolid.size() );
for ( unsigned int i = 0; i < dofFluid.size(); i++ )
{
dof.push_back( dofFluid.at( i ) );
enabled.push_back( enabledFluid.at( i ) );
names.push_back( namesFluid.at( i ) );
}
for ( unsigned int i = 0; i < dofSolid.size(); i++ )
{
dof.push_back( dofSolid.at( i ) );
enabled.push_back( enabledSolid.at( i ) );
names.push_back( namesSolid.at( i ) );
}
}
示例10: LoadData
void LoadData(std::deque<mitk::ContourModelSet::Pointer> &r)
{
std::vector<itk::SmartPointer<mitk::BaseData> > readerOutput;
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/BODY.cnt_set"));
mitk::ContourModelSet::Pointer cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("BODY"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Bladder.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Bladder"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Femoral Head Lt.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Femoral Head Lt"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Femoral Head RT.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Femoral Head RT"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/PTV.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("PTV"));
r.push_back(cnt_set);
readerOutput = mitk::IOUtil::Load(GetTestDataFilePath("RT/StructureSet/Rectum.cnt_set"));
cnt_set = dynamic_cast<mitk::ContourModelSet*>(readerOutput.at(0).GetPointer());
cnt_set->SetProperty("name", mitk::StringProperty::New("Rectum"));
r.push_back(cnt_set);
}
示例11: run_sim
void run_sim(void)
{
BondMap::iterator weakest;
Bond hypocenter;
counter = 0;
for (i=0; i<N;)
{
weakest = accessibleBonds.begin();
already_invaded = invade_bond(weakest->second, weakest->first);
if(!already_invaded)
{
if(weakest->first < cutoff)
{
if(counter == 0)
{
hypocenter = weakest->second;
}
counter +=1;
}
else
{
if(counter != 0)
{
if(burst_counts.count(counter) > 0)
{
burst_counts[counter] += 1;
}
else
{
burst_counts.insert(std::make_pair(counter,1));
}
burst_list.push_back(boost::make_tuple(hypocenter.first.first, hypocenter.first.second, counter));
counter = 0;
}
}
if(chem_level_list.count(weakest->second.first ) > 0)
{
chem_level_list.insert(std::make_pair(weakest->second.second, chem_level_list[weakest->second.first]+1));
}
else
{
chem_level_list.insert(std::make_pair(weakest->second.second, 1));
}
i++;
}
accessibleBonds.erase(weakest);
}
}
示例12: internal_write
void AdminClient::internal_write(message msg) {
bool writing = !write_queue_.empty();
//std::cout << "Adding message \"" << msg.data() << "\" to queue\n";
write_queue_.push_back(msg);
if (!writing){
boost::asio::async_write(sock_, boost::asio::buffer(write_queue_.front().data()),
boost::bind(&AdminClient::write_handler, this,
boost::asio::placeholders::error));
}
}
示例13: push
void push(const TaskPtr& task) {
if (!_running) {
return;
}
boost::unique_lock<boost::mutex> lock(_mutex);
std::cout << "push A" << std::endl;
_tasks.push_back(task);
if (_tasks.size() >= 1) {
std::cout << "push B" << std::endl;
_no_task.notify_one();
std::cout << "push C" << std::endl;
}
}
示例14: recurDir
void recurDir(const std::string &pathName, std::deque<std::string> &queue) {
DIR *dir = opendir(pathName.c_str());
if (!dir) {
std::cerr << pathName << ": " << strerror(errno) << std::endl;
return;
}
while (dirent *aFile = readdir(dir)) {
if (aFile->d_name[0] == '.') continue;
std::string path = pathName + "/" + aFile->d_name;
queue.push_back(path);
}
closedir(dir);
}
示例15: genSprites3d
void genSprites3d(float size,int across, int depth, std::deque<sparky::graphics::Renderable3D*>& queue, sparky::graphics::Window& window){
sparky::maths::vec3 s(size * 0.9f,0.01f, size * 0.9f);
for (float y = size * 0.05; y < 50; y += size){
for (float x = size * 0.05; x < 10; x += size){
queue.push_back(new
sparky::graphics::Renderable3D
(sparky::maths::vec3(x - (WINDOW_WIDTH/2), -0.5, y-1),
s,
sparky::maths::vec4(rand() % 1000 / 1000.0f, rand() % 1000 / 1000.0f, rand() % 1000 / 1000.0f, 1)
));
}
}
}