예제 #1
0
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;
		}
	}
}
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
0
파일: string_parsing.cpp 프로젝트: hdzz/rpc
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
0
	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);
				}
			}
		}
	}
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}}
}
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}}
}
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}}
}
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
}
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
0
	const_iterator cend() const{ return futures.cend(); }
예제 #11
0
 const_iterator end() const    { return Items.cend();   }