<commit_before>#pragma once
#include "Head.h"

template<typename T>
class Stack {
public:
	using value_type = T;
	using size_type = size_t;
	using reference = value_type&;
	using const_reference = const value_type&;
	using rvalue = value_type&&;
	using container = std::vector<value_type>;

	Stack(const size_type max_size) : data_(container(max_size)), top_index_(0) {}
	Stack() = delete;

	Stack(const Stack&) = default;
	Stack& operator =(const Stack&) = default;
	Stack(Stack&&) = default;
	Stack& operator =(Stack&&) = default;

	reference top() {
		return data_[top_index_ - 1];
	}

	const_reference top() const {
		return data_[top_index_ - 1];
	}

	constexpr bool empty() const {
		return top_index_ == 0;
	}

	constexpr size_type size() const {
		return top_index_;
	}

	void push(const_reference value) {
		data_[top_index_++] = value;
	}

	void push(rvalue value) {
		data_[top_index_++] = std::move(value);
	}

	value_type pop() {
		return data_[--top_index_];
	}

	void swap(Stack& rhs) {
		data_.swap(rhs.data_);
		std::swap(top_index_, rhs.top_index_);
	}
<commit_msg>Implemented Stack::clear() method.<commit_after>#pragma once
#include "Head.h"

template<typename T>
class Stack {
public:
	using value_type = T;
	using size_type = size_t;
	using reference = value_type&;
	using const_reference = const value_type&;
	using rvalue = value_type&&;
	using container = std::vector<value_type>;

	Stack(const size_type max_size) : data_(container(max_size)), top_index_(0) {}
	Stack() = delete;

	Stack(const Stack&) = default;
	Stack& operator =(const Stack&) = default;
	Stack(Stack&&) = default;
	Stack& operator =(Stack&&) = default;

	reference top() {
		return data_[top_index_ - 1];
	}

	const_reference top() const {
		return data_[top_index_ - 1];
	}

	constexpr bool empty() const {
		return top_index_ == 0;
	}

	void clear() {
		top_index_ = 0;
	}

	constexpr size_type size() const {
		return top_index_;
	}

	void push(const_reference value) {
		data_[top_index_++] = value;
	}

	void push(rvalue value) {
		data_[top_index_++] = std::move(value);
	}

	value_type pop() {
		return data_[--top_index_];
	}

	void swap(Stack& rhs) {
		data_.swap(rhs.data_);
		std::swap(top_index_, rhs.top_index_);
	}

{'fraction_non_alphanumeric': 0.14157303370786517, 'fraction_numerical': 0.004044943820224719, 'mean_word_length': 4.537313432835821, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '711188', 'n_tokens_mistral': 848, 'n_tokens_neox': 802, 'n_words': 192}