本文整理汇总了C++中std::deque::front方法的典型用法代码示例。如果您正苦于以下问题:C++ deque::front方法的具体用法?C++ deque::front怎么用?C++ deque::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::deque
的用法示例。
在下文中一共展示了deque::front方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gputask_Join
void gputask_Join()
{
if(!g_kickedTasks.empty())
{
auto ptr = g_kickedTasks.front();
g_kickedTasks.pop_front();
ptr->m_complete();
}
}
示例2: outputCountsOfWordList
void CountMin::outputCountsOfWordList(std::deque<string> wordlist){
while(!wordlist.empty()){
std::string word = wordlist.front();
int count = queryCountOfString(word);
printf("%d,%s\n",count,word.c_str());
wordlist.pop_front();
}
}
示例3: do_work
void do_work (CompletionCounter)
{
if (m_called_stop.load () == 1)
return;
// We don't have any work to do at this time
if (m_work.empty())
{
m_idle = true;
m_journal.trace << "Sleeping";
return;
}
if (m_work.front().names.empty())
m_work.pop_front();
std::string const name (m_work.front().names.back());
HandlerType handler (m_work.front().handler);
m_work.front().names.pop_back();
HostAndPort const hp (parseName(name));
if (hp.first.empty())
{
m_journal.error <<
"Unable to parse '" << name << "'";
m_io_service.post (m_strand.wrap (boost::bind (
&NameResolverImpl::do_work, this,
CompletionCounter(this))));
return;
}
boost::asio::ip::tcp::resolver::query query (
hp.first, hp.second);
m_resolver.async_resolve (query, boost::bind (
&NameResolverImpl::do_finish, this, name,
boost::asio::placeholders::error, handler,
boost::asio::placeholders::iterator,
CompletionCounter(this)));
}
示例4: dijkstra_FIFO_thread
void dijkstra_FIFO_thread(CSRGraph *g, int *dist, std::deque<int> &deq, int threadNum, std::mutex *dist_locks)
{
while(!deq.empty())
{
queue_lock.lock();
if(deq.empty()){
queue_lock.unlock();
break;
}
int u = deq.front();
deq.pop_front();
printf("Popped\n");
for(int i=0; i< deq.size();i++){
printf(" %d", deq[i]);
}
printf("\n");
int udist = dist[u];
queue_lock.unlock();
std::vector<int> neighbors = CSRGraph_getNeighbors(g, u);
int neighbor;
for(neighbor=0;neighbor < neighbors.size(); neighbor++)
{
int v = neighbors[neighbor];
int uvdist = CSRGraph_getDistance(g, u, v);
int alt = udist + uvdist;
dist_locks[v].lock();
if(alt < dist[v])
{
dist[v] = alt;
dist_locks[v].unlock();
queue_lock.lock();
deq.push_back(v);
printf("Pushed\n");
for(int i=0; i< deq.size();i++){
printf(" %d", deq[i]);
}
printf("\n");
queue_lock.unlock();
}
else
{
dist_locks[v].unlock();
}
}
}
//printf("Thread %d ended.\n", threadNum);
}
示例5: ProcessFile
void pfPatcherWorker::ProcessFile()
{
do {
NetCliFileManifestEntry& entry = fQueuedFiles.front();
// eap sucks
plFileName clName = plString::FromWchar(entry.clientName);
plString dlName = plString::FromWchar(entry.downloadName);
// Check to see if ours matches
plFileInfo mine(clName);
if (mine.FileSize() == entry.fileSize) {
plMD5Checksum cliMD5(clName);
plMD5Checksum srvMD5;
srvMD5.SetFromHexString(plString::FromWchar(entry.md5, 32).c_str());
if (cliMD5 == srvMD5) {
WhitelistFile(clName, false);
fQueuedFiles.pop_front();
continue;
}
}
// It's different... but do we want it?
if (fFileDownloadDesired) {
if (!fFileDownloadDesired(clName)) {
PatcherLogRed("\tDeclined '%S'", entry.clientName);
fQueuedFiles.pop_front();
continue;
}
}
// If you got here, they're different and we want it.
PatcherLogYellow("\tEnqueuing '%S'", entry.clientName);
plFileSystem::CreateDir(plFileName(clName).StripFileName());
// If someone registered for SelfPatch notifications, then we should probably
// let them handle the gruntwork... Otherwise, go nuts!
if (fSelfPatch) {
if (clName == plFileSystem::GetCurrentAppPath().GetFileName()) {
clName += ".tmp"; // don't overwrite myself!
entry.flags |= kSelfPatch;
}
}
pfPatcherStream* s = new pfPatcherStream(this, dlName, entry);
s->Open(clName, "wb");
hsTempMutexLock lock(fRequestMut);
fRequests.push_back(Request(dlName, Request::kFile, s));
fQueuedFiles.pop_front();
if (!fRequestActive)
IssueRequest();
} while (!fQueuedFiles.empty());
}
示例6: write_chunk
void write_chunk() {
std::size_t chunk = wait_for_empty_chunk();
std::size_t chunk_bytes = std::min( byte_queue.size(), bytes_per_chunk );
waveheaders[chunk].dwBufferLength = static_cast<DWORD>( chunk_bytes );
for ( std::size_t byte = 0; byte < chunk_bytes; ++byte ) {
wavebuffers[chunk][byte] = byte_queue.front();
byte_queue.pop_front();
}
waveOutWrite( waveout, &waveheaders[chunk], sizeof( WAVEHDR ) );
}
示例7: mock_getrandom
ssize_t mock_getrandom(void *buffer, size_t length, unsigned int flags)
{
boost::ignore_unused(buffer);
boost::ignore_unused(length);
boost::ignore_unused(flags);
bool success = getrandom_next_result.front();
getrandom_next_result.pop_front();
return success ? static_cast< ssize_t >(length) : static_cast< ssize_t >(-1);
}
示例8: main
int main(int, char**)
{
{
std::deque<int> c = make<std::deque<int> >(10);
for (int i = 0; i < 10; ++i)
assert(c[i] == i);
for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
}
{
const std::deque<int> c = make<std::deque<int> >(10);
for (int i = 0; i < 10; ++i)
assert(c[i] == i);
for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
}
#if TEST_STD_VER >= 11
{
std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
for (int i = 0; i < 10; ++i)
assert(c[i] == i);
for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
}
{
const std::deque<int, min_allocator<int>> c = make<std::deque<int, min_allocator<int>> >(10);
for (int i = 0; i < 10; ++i)
assert(c[i] == i);
for (int i = 0; i < 10; ++i)
assert(c.at(i) == i);
assert(c.front() == 0);
assert(c.back() == 9);
}
#endif
return 0;
}
示例9: insert_simple
iterator insert_simple(iterator itr,const T& _val){
Datum* pos=Ptrs.front();
Ptrs.pop_front();
pos->t=_val;
pos->front=itr.dat;
pos->back=itr.dat->back;
pos->back->front=pos;
pos->front->back=pos;
return iterator(pos);
}
示例10: queryCountOfString
deque<int> CountMin::returnCountsOfWordList(std::deque<string> wordlist){
deque<int> counts;
while(!wordlist.empty()){
std::string word = wordlist.front();
int count = queryCountOfString(word);
counts.push_back(count);
wordlist.pop_front();
}
return counts;
}
示例11: next
Hash next(size_t depth) {
if (queue.size() > 0) {
Hash h = queue.front();
queue.pop_front();
return h;
} else {
return emptyroots.empty_root(depth);
}
}
示例12: record_seed
bool record_seed(Uint64 new_seed) {
if (!unordered_history.insert(new_seed).second) return false;
current_seed = new_seed;
history.push_back(current_seed);
if (history.size() > history_limit) {
unordered_history.erase(history.front());
history.pop_front();
}
return true;
}
示例13: tryDequeFront
uint64_t tryDequeFront(std::vector<value_type> & V, uint64_t max)
{
libmaus2::parallel::ScopePosixSpinLock llock(lock);
while ( max-- && Q.size() )
{
V.push_back(Q.front());
Q.pop_front();
}
return V.size();
}
示例14: returnActualCountsOfWordList
deque<int> returnActualCountsOfWordList(std::deque<string> wordlist,map<std::string , int> actual_counts){
deque<int> counts;
while(!wordlist.empty()){
std::string word = wordlist.front();
int count = actual_counts[word];
counts.push_back(count);
wordlist.pop_front();
}
return counts;
}
示例15: try_pop_task
task_type try_pop_task() {
task_type ret;
boost::lock_guard<boost::mutex> lock(tasks_mutex_);
if (!tasks_.empty()) {
ret = tasks_.front();
tasks_.pop_front();
}
return ret;
}