<commit_before>#pragma once

#include <concepts>
#include <cstdint>
#include <stdexcept>
#include <vector>

namespace utils {

template <typename TValue>
class Matrix {
public:
  using ValueType = typename std::vector<TValue>::value_type;

  Matrix(int64_t height, int64_t width, TValue defaultValue = TValue{})
    : m_height(height)
    , m_width(width)
    , m_values(this->m_height * this->m_width, defaultValue) {
    if (this->m_height < 1) {
      throw std::invalid_argument{"The height of the matrix must be positive!"};
    }
    if (this->m_width < 1) {
      throw std::invalid_argument{"The width of the matrix must be positive!"};
    }
  }

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

  Matrix(Matrix &&other) noexcept
    : m_height(other.m_height)
    , m_width(other.m_width)
    , m_values(std::move(other.m_values)) {
    other.m_height = 0;
    other.m_width = 0;
  }

  Matrix &operator=(Matrix &&other) noexcept {
    if (this != &other) {
      this->m_height = other.m_height;
      this->m_width = other.m_width;
      this->m_values = other.m_values;
    }<commit_msg>Fix Matrix's move assignment operator<commit_after>#pragma once

#include <concepts>
#include <cstdint>
#include <stdexcept>
#include <vector>

namespace utils {

template <typename TValue>
class Matrix {
public:
  using ValueType = typename std::vector<TValue>::value_type;

  Matrix(int64_t height, int64_t width, TValue defaultValue = TValue{})
    : m_height(height)
    , m_width(width)
    , m_values(this->m_height * this->m_width, defaultValue) {
    if (this->m_height < 1) {
      throw std::invalid_argument{"The height of the matrix must be positive!"};
    }
    if (this->m_width < 1) {
      throw std::invalid_argument{"The width of the matrix must be positive!"};
    }
  }

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

  Matrix(Matrix &&other) noexcept
    : m_height(other.m_height)
    , m_width(other.m_width)
    , m_values(std::move(other.m_values)) {
    other.m_height = 0;
    other.m_width = 0;
  }

  Matrix &operator=(Matrix &&other) noexcept {
    if (this != &other) {
      this->m_height = other.m_height;
      this->m_width = other.m_width;
      this->m_values = std::move(other.m_values);
      other.m_height = 0;
      other.m_width = 0;
    }
{'fraction_non_alphanumeric': 0.1337011884550085, 'fraction_numerical': 0.007640067911714771, 'mean_word_length': 3.5766990291262135, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '5520646', 'n_tokens_mistral': 829, 'n_tokens_neox': 802, 'n_words': 184}