本文整理汇总了C++中std::deque::cbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ deque::cbegin方法的具体用法?C++ deque::cbegin怎么用?C++ deque::cbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::deque
的用法示例。
在下文中一共展示了deque::cbegin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveDuplicate
void CFolderCrawler::RemoveDuplicate(std::deque<CTGitPath> &list,const CTGitPath &path)
{
for (auto it = list.cbegin(); it != list.cend(); ++it)
{
if(*it == path)
{
list.erase(it);
it = list.cbegin(); /* search again*/
if (it == list.cend())
break;
}
}
}
示例2: sum_of_distance
ChinesePostman::EdgeWeightType sum_of_distance(const std::deque<ChinesePostman::SubRoute> & route){
ChinesePostman::EdgeWeightType result = 0;
for(auto it = route.cbegin(); it != route.cend(); ++it){
result += it->weight;
}
return result;
}
示例3: bad_erase_deque1
void bad_erase_deque1(std::deque<int> &D) {
auto i2 = D.cbegin(), i0 = i2++, i1 = i2++;
D.erase(i1);
*i0; // expected-warning{{Invalidated iterator accessed}}
*i1; // expected-warning{{Invalidated iterator accessed}}
*i2; // expected-warning{{Invalidated iterator accessed}}
}
示例4: interpretPacket
msgBase::ptr LaunchBallRequest::interpretPacket( const std::deque<char>& _buffer )
{
LaunchBallRequest::ptr egr = LaunchBallRequest::ptr(new LaunchBallRequest());
std::deque<char>::const_iterator it = _buffer.cbegin();
it = unpack(egr->msgHeader, it);
it = unpack(egr->gType, it);
return egr;
}
示例5: interpretPacket
msgBase::ptr AcknowledgeLast::interpretPacket( const std::deque<char>& _buffer )
{
AcknowledgeLast::ptr rc = AcknowledgeLast::ptr(new AcknowledgeLast());
std::deque<char>::const_iterator it = _buffer.cbegin();
it = unpack(rc->msgHeader, it);
it = unpack(rc->ackBool, it);
it = unpack(rc->ackType, it);
return rc;
}
示例6: interpretPacket
msgBase::ptr EndGameResponse::interpretPacket( const std::deque<char>& _buffer )
{
EndGameResponse::ptr egr = EndGameResponse::ptr(new EndGameResponse());
std::deque<char>::const_iterator it = _buffer.cbegin();
it = unpack(egr->msgHeader, it);
it = unpack(egr->gType, it);
it = unpack(egr->res, it);
return egr;
}
示例7: interpretPacket
msgBase::ptr PaddleUpdateRequest::interpretPacket( const std::deque<char>& _buffer )
{
PaddleUpdateRequest::ptr pur = PaddleUpdateRequest::ptr(new PaddleUpdateRequest());
std::deque<char>::const_iterator it = _buffer.cbegin();
it = unpack(pur->msgHeader, it);
it = unpack(pur->gType, it);
it = unpack(pur->p, it);
return pur;
}
示例8: print_results
std::string print_results (std::deque<T> const& l)
{
std::stringstream out;
if (not l.empty()) {
out << "[";
for (auto it = l.cbegin(); it != std::prev(l.cend()); ++it)
out << fnk::utility::to_string<T> (*it) + ", ";
out << fnk::utility::to_string<T>(l.back()) + "]";
} else
out << "[]";
return out.str();
}
示例9: selectPhotos
void PictFrame::selectPhotos(const std::deque<YString>& pool)
{
unsigned int poolSize = static_cast<unsigned int>(pool.size());
// TODO Adjust the message when not enough photos...
logs.notice() << "There are " << poolSize << " photos in the pool; "
<< "among which " << pNbPhotos << " will be selected";
if (poolSize <= pNbPhotos)
{
// Trivial case: keep all photos!
for (auto it = pool.cbegin(), end = pool.cend(); it != end; ++it)
{
ExtendedPhoto::ExtendedPhoto::Ptr ptr = new ExtendedPhoto::ExtendedPhoto(logs, pCameras, *it);
pPhotosChosen.push_back(ptr);
}
}
else
{
std::vector<unsigned int> randomSequence;
// Select semi-randomly a subset of indexes between 0 and poolSize - 1
semiRandomSubset(randomSequence, poolSize, pNbPhotos);
GenericTools::printContainer(std::cout, randomSequence, ", ", "Random sequence is: ", "\n");
{
// Finally create the list from the index generated above
for (auto it = randomSequence.cbegin(), end = randomSequence.cend();
it != end; ++it)
{
assert(*it < poolSize);
ExtendedPhoto::ExtendedPhoto::Ptr ptr =
new ExtendedPhoto::ExtendedPhoto(logs, pCameras, pool[*it]);
pPhotosChosen.push_back(ptr);
}
}
}
}
示例10: good_pop_front_deque1
void good_pop_front_deque1(std::deque<int> &D, int n) {
auto i1 = D.cbegin(), i0 = i1++;
D.pop_front();
*i1; // no-warning
}
示例11: bad_push_back_deque1
void bad_push_back_deque1(std::deque<int> &D, int n) {
auto i0 = D.cbegin(), i1 = D.cend();
D.push_back(n);
*i0; // expected-warning{{Invalidated iterator accessed}}
--i1; // expected-warning{{Invalidated iterator accessed}}
}
示例12: cbegin
/**
* Iterate over the futures of all posted jobs.
* Iteration occurs in the order the jobs were added.
*/
const_iterator cbegin() const{ return futures.cbegin(); }
示例13: bad_pop_back_deque1
void bad_pop_back_deque1(std::deque<int> &D, int n) {
auto i0 = D.cbegin(), i1 = D.cend(), i2 = i1--;
D.pop_back();
*i1; // expected-warning{{Invalidated iterator accessed}}
--i2; // expected-warning{{Invalidated iterator accessed}}
}
示例14: good_pop_back_deque1
void good_pop_back_deque1(std::deque<int> &D, int n) {
auto i0 = D.cbegin(), i1 = D.cend(), i2 = i1--;
D.pop_back();
*i0; // no-warning
}
示例15: bad_assign_deque1
void bad_assign_deque1(std::deque<int> &D, int n) {
auto i0 = D.cbegin();
D.assign(10, n);
*i0; // expected-warning{{Invalidated iterator accessed}}
}