<commit_before>#pragma once

#include <cassert>
#include <cstddef>
#include <iterator>
#include <type_traits>

namespace nonstd
{
template <typename T>
struct null_popper
{
	void operator()(T&) const noexcept;
};

template <typename T>
struct default_popper
{
	T operator()(T& t) const;
};

template <typename T>
struct copy_popper
{
	copy_popper(T t);
	T operator()(T& t) const;

private:
	T m_copy;
};

template <typename, bool>
class ring_iterator;

template <typename T, class Popper = default_popper<T>>
class ring_span
{
public:
	using type = ring_span<T, Popper>;
	using size_type = std::size_t;
	using value_type = T;
	using pointer = T*;
	using reference = T&;
	using const_reference = const T&;
	using iterator = ring_iterator<type, false>;
	using const_iterator = ring_iterator<type, true>;
	using reverse_iterator = std::reverse_iterator<iterator>;
	using const_reverse_iterator = std::reverse_iterator<const_iterator>;

	friend class ring_iterator<type, false>;
	friend class ring_iterator<type, true>;

	template <class ContiguousIterator>
	ring_span(ContiguousIterator begin, ContiguousIterator end, Popper p = Popper()) noexcept;

	template <class ContiguousIterator>
	ring_span(ContiguousIterator begin, ContiguousIterator end, ContiguousIterator first, size_type size,
			  Popper p = Popper()) noexcept;

	ring_span(ring_span&&) = default;
	ring_span& operator=(ring_span&&) = default;

	bool empty() const noexcept;
	bool full() const noexcept;
	size_type size() const noexcept;
	size_type capacity() const noexcept;

	reference front() noexcept;
	const_reference front() const noexcept;
	reference back() noexcept;
	const_reference back() const noexcept;

	iterator begin() noexcept;
	const_iterator begin() const noexcept;
	iterator end() noexcept;
	const_iterator end() const noexcept;

	const_iterator cbegin() const noexcept;
	const_reverse_iterator crbegin() const noexcept;
	reverse_iterator rbegin() noexcept;
	const_reverse_iterator rbegin() const noexcept;
	const_iterator cend() const noexcept;
	const_reverse_iterator crend() const noexcept;
	reverse_iterator rend() noexcept;
	const_reverse_iterator rend() const noexcept;

	template <bool b = true, typename = std::enable_if_t<b && std::is_copy_assignable<T>::value>>
	void push_back(const value_type& from_value) noexcept(std::is_nothrow_copy_assignable<T>::value);
	template <bool b = true, typename = std::enable_if_t<b && std::is_move_assignable<T>::value>>
	void push_back(value_type&& from_value) noexcept(std::is_nothrow_move_assignable<T>::value);
	template <class... FromType>
	void emplace_back(FromType&&... from_value) noexcept(
		std::is_nothrow_constructible<T, FromType...>::value&& std::is_nothrow_move_assignable<T>::value);
	auto pop_front();

	void swap(type& rhs) noexcept; // (std::is_nothrow_swappable<Popper>::value);

	// Example implementation
private:
	reference at(size_type idx) noexcept;
	const_reference at(size_type idx) const noexcept;
	size_type back_idx() const noexcept;
	void increase_size() noexcept;

	T* m_data;
	size_type m_size;
	size_type m_capacity;
	size_type m_front_idx;
	Popper m_popper;
};

template <typename T, class Popper>
void swap(ring_span<T, Popper>&, ring_span<T, Popper>&) noexcept;

template <typename Ring, bool is_const>
class ring_iterator
{
public:
	using type = ring_iterator<Ring, is_const>;
	using value_type = typename Ring::value_type;
	using difference_type = std::ptrdiff_t;
	using pointer = typename std::conditional_t<is_const, const value_type, value_type>*;
	using reference = typename std::conditional_t<is_const, const value_type, value_type>&;
	using iterator_category = std::random_access_iterator_tag;

	operator ring_iterator<Ring, true>() const noexcept;

	template <bool C>
	bool operator==(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator!=(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator<(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator<=(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator>(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator>=(const ring_iterator<Ring, C>& rhs) const noexcept;<commit_msg>fixed warnings<commit_after>#pragma once

#include <cassert>
#include <cstddef>
#include <iterator>
#include <type_traits>

namespace nonstd
{
template <typename T>
struct null_popper
{
	void operator()(T&) const noexcept;
};

template <typename T>
struct default_popper
{
	T operator()(T& t) const;
};

template <typename T>
struct copy_popper
{
	copy_popper(T t);
	T operator()(T& t) const;

private:
	T m_copy;
};

template <typename, bool>
class ring_iterator;

template <typename T, class Popper = default_popper<T>>
class ring_span
{
public:
	using type = ring_span<T, Popper>;
	using size_type = std::size_t;
	using value_type = T;
	using pointer = T*;
	using reference = T&;
	using const_reference = const T&;
	using iterator = ring_iterator<type, false>;
	using const_iterator = ring_iterator<type, true>;
	using reverse_iterator = std::reverse_iterator<iterator>;
	using const_reverse_iterator = std::reverse_iterator<const_iterator>;

	friend class ring_iterator<type, false>;
	friend class ring_iterator<type, true>;

	template <class ContiguousIterator>
	ring_span(ContiguousIterator begin, ContiguousIterator end, Popper p = Popper()) noexcept;

	template <class ContiguousIterator>
	ring_span(ContiguousIterator begin, ContiguousIterator end, ContiguousIterator first, size_type size,
			  Popper p = Popper()) noexcept;

	ring_span(ring_span&&) = default;
	ring_span& operator=(ring_span&&) = default;

	bool empty() const noexcept;
	bool full() const noexcept;
	size_type size() const noexcept;
	size_type capacity() const noexcept;

	reference front() noexcept;
	const_reference front() const noexcept;
	reference back() noexcept;
	const_reference back() const noexcept;

	iterator begin() noexcept;
	const_iterator begin() const noexcept;
	iterator end() noexcept;
	const_iterator end() const noexcept;

	const_iterator cbegin() const noexcept;
	const_reverse_iterator crbegin() const noexcept;
	reverse_iterator rbegin() noexcept;
	const_reverse_iterator rbegin() const noexcept;
	const_iterator cend() const noexcept;
	const_reverse_iterator crend() const noexcept;
	reverse_iterator rend() noexcept;
	const_reverse_iterator rend() const noexcept;

	template <bool b = true, typename = std::enable_if_t<b && std::is_copy_assignable<T>::value>>
	void push_back(const value_type& from_value) noexcept(std::is_nothrow_copy_assignable<T>::value);
	template <bool b = true, typename = std::enable_if_t<b && std::is_move_assignable<T>::value>>
	void push_back(value_type&& from_value) noexcept(std::is_nothrow_move_assignable<T>::value);
	template <class... FromType>
	void emplace_back(FromType&&... from_value) noexcept(
		std::is_nothrow_constructible<T, FromType...>::value&& std::is_nothrow_move_assignable<T>::value);
	auto pop_front();

	void swap(type& rhs) noexcept; // (std::is_nothrow_swappable<Popper>::value);

	// Example implementation
private:
	reference at(size_type idx) noexcept;
	const_reference at(size_type idx) const noexcept;
	size_type back_idx() const noexcept;
	void increase_size() noexcept;

	T* m_data = nullptr;
	size_type m_size = 0;
	size_type m_capacity = 0;
	size_type m_front_idx = 0;
	Popper m_popper;
};

template <typename T, class Popper>
void swap(ring_span<T, Popper>&, ring_span<T, Popper>&) noexcept;

template <typename Ring, bool is_const>
class ring_iterator
{
public:
	using type = ring_iterator<Ring, is_const>;
	using value_type = typename Ring::value_type;
	using difference_type = std::ptrdiff_t;
	using pointer = typename std::conditional_t<is_const, const value_type, value_type>*;
	using reference = typename std::conditional_t<is_const, const value_type, value_type>&;
	using iterator_category = std::random_access_iterator_tag;

	operator ring_iterator<Ring, true>() const noexcept;

	template <bool C>
	bool operator==(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator!=(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator<(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator<=(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator>(const ring_iterator<Ring, C>& rhs) const noexcept;
	template <bool C>
	bool operator>=(const ring_iterator<Ring, C>& rhs) const noexcept;
{'fraction_non_alphanumeric': 0.11094171455377037, 'fraction_numerical': 0.0003518236190922951, 'mean_word_length': 6.72463768115942, 'pattern_counts': {'":': 0, '<': 109, '<?xml version=': 0, '>': 109, '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': '5511921', 'n_tokens_mistral': 2853, 'n_tokens_neox': 2780, 'n_words': 776}