本文整理汇总了C++中std::deque::cend方法的典型用法代码示例。如果您正苦于以下问题:C++ deque::cend方法的具体用法?C++ deque::cend怎么用?C++ deque::cend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::deque
的用法示例。
在下文中一共展示了deque::cend方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例4: 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);
}
}
}
}
示例5: bad_clear_deque1
void bad_clear_deque1(std::deque<int> &D) {
auto i0 = D.cbegin(), i1 = D.cend();
D.clear();
*i0; // expected-warning{{Invalidated iterator accessed}}
--i1; // expected-warning{{Invalidated iterator accessed}}
}
示例6: bad_emplace_front_deque1
void bad_emplace_front_deque1(std::deque<int> &D, int n) {
auto i0 = D.cbegin(), i1 = D.cend();
D.emplace_front(n);
*i0; // expected-warning{{Invalidated iterator accessed}}
--i1; // expected-warning{{Invalidated iterator accessed}}
}
示例7: 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}}
}
示例8: 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
}
示例9: 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}}
}
示例10: cend
const_iterator cend() const{ return futures.cend(); }
示例11: end
const_iterator end() const { return Items.cend(); }