<commit_before>#ifndef FILTER_ITERATOR_HPP
#define FILTER_ITERATOR_HPP

#include <iterator>
#include <vector>


namespace nonstd
{

/**
 * Filter iterator template that allows to iterate forward skipping
 * items that do not satisfy the specified predicate.
 */
template <typename ForwardIterator, typename UnaryPredicate>
class filter_iterator {
public:
	typedef typename std::iterator_traits<ForwardIterator>::reference
		reference;
	typedef typename std::iterator_traits<ForwardIterator>::pointer
		pointer;
	typedef typename std::iterator_traits<ForwardIterator>::value_type
		value_type;


	filter_iterator(ForwardIterator begin, ForwardIterator end,
		UnaryPredicate predicate) : begin_(begin), end_(end),
		iter_(begin), predicate_(predicate)
	{
		if ((this->iter_ != this->end_)
			&& !this->predicate_(*this->iter_)) {
			this->increment();
		}
	}


	reference
	operator*() const
	{
		return *this->iter_;
	}


	/**
	 * Converts filter iterator to it's original iterator.
	 */
	operator ForwardIterator() const
	{
		return this->iter_;
	}


	/**
	 * Compares filter iterator with it's original forward iterator.
	 * Useful for comparing if forward iterator is not end iterator.
	 */
	bool
	operator==(const ForwardIterator& it) const
	{
		return this->iter_ == it;
	}


	/**
	 * Advances iterator until the predicate is true.
	 *
	 * @return reference to advanced iterator.
	 */
	filter_iterator<ForwardIterator, UnaryPredicate>&
	operator++()
	{
		this->increment();
		return *this;
	}


	/**
	 * @return pointer to item pointed by the iterator.
	 */
	pointer
	operator->() const
	{
		return this->iter_.operator->();
	}


private:
	ForwardIterator begin_;
	ForwardIterator end_;
	ForwardIterator iter_;
	UnaryPredicate predicate_;
	std::vector<UnaryPredicate> predicates_;


	/**
	 * Increments iterator until it satisfies the predicate.
	 */
	void increment()
	{
		while ((this->iter_ != this->end_)
			&& !this->predicate_(*(++this->iter_))) {
		}
	}
};

} // namespace nonstd.

#endif /* FILTER_ITERATOR_HPP */<commit_msg>Removed dead code.<commit_after>#ifndef FILTER_ITERATOR_HPP
#define FILTER_ITERATOR_HPP

#include <iterator>


namespace nonstd
{

/**
 * Filter iterator template that allows to iterate forward skipping
 * items that do not satisfy the specified predicate.
 */
template <typename ForwardIterator, typename UnaryPredicate>
class filter_iterator {
public:
	typedef typename std::iterator_traits<ForwardIterator>::reference
		reference;
	typedef typename std::iterator_traits<ForwardIterator>::pointer
		pointer;
	typedef typename std::iterator_traits<ForwardIterator>::value_type
		value_type;


	filter_iterator(ForwardIterator begin, ForwardIterator end,
		UnaryPredicate predicate) : begin_(begin), end_(end),
		iter_(begin), predicate_(predicate)
	{
		if ((this->iter_ != this->end_)
			&& !this->predicate_(*this->iter_)) {
			this->increment();
		}
	}


	reference
	operator*() const
	{
		return *this->iter_;
	}


	/**
	 * Converts filter iterator to it's original iterator.
	 */
	operator ForwardIterator() const
	{
		return this->iter_;
	}


	/**
	 * Compares filter iterator with it's original forward iterator.
	 * Useful for comparing if forward iterator is not end iterator.
	 */
	bool
	operator==(const ForwardIterator& it) const
	{
		return this->iter_ == it;
	}


	/**
	 * Advances iterator until the predicate is true.
	 *
	 * @return reference to advanced iterator.
	 */
	filter_iterator<ForwardIterator, UnaryPredicate>&
	operator++()
	{
		this->increment();
		return *this;
	}


	/**
	 * @return pointer to item pointed by the iterator.
	 */
	pointer
	operator->() const
	{
		return this->iter_.operator->();
	}


private:
	ForwardIterator begin_;
	ForwardIterator end_;
	ForwardIterator iter_;
	UnaryPredicate predicate_;


	/**
	 * Increments iterator until it satisfies the predicate.
	 */
	void increment()
	{
		while ((this->iter_ != this->end_)
			&& !this->predicate_(*(++this->iter_))) {
		}
	}
};

} // namespace nonstd.

#endif /* FILTER_ITERATOR_HPP */
{'fraction_non_alphanumeric': 0.12023898431665422, 'fraction_numerical': 0.0, 'mean_word_length': 4.211413748378729, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2390937', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1179, 'n_words': 326}