<commit_before>//
//  yas_state.h
//

#pragma once

#include "yas_base.h"
#include <functional>
#include <unordered_map>

namespace yas {
template <typename T>
class state_machine : public base {
    struct impl;

   public:
    struct changer {
        weak<state_machine> weak_machine;

        void change(T const &key) const;
        
        T const &current() const;
    };

    using handler_f = std::function<void(changer const &)>;
    using handlers_t = std::unordered_map<T, typename state_machine<T>::handler_f>;

    state_machine();
    explicit state_machine(T initial, std::unordered_map<T, handler_f> handlers);
    state_machine(std::nullptr_t);

    void register_state(T key, handler_f handler);

    void change_state(T key);

    T const &current_state() const;
};

template <typename T>
state_machine<T> make_state_machine(T initial, typename state_machine<T>::handlers_t handlers);
}

#include "yas_state_machine_private.h"<commit_msg>remove explicit<commit_after>//
//  yas_state.h
//

#pragma once

#include "yas_base.h"
#include <functional>
#include <unordered_map>

namespace yas {
template <typename T>
class state_machine : public base {
    struct impl;

   public:
    struct changer {
        weak<state_machine> weak_machine;

        void change(T const &key) const;
        
        T const &current() const;
    };

    using handler_f = std::function<void(changer const &)>;
    using handlers_t = std::unordered_map<T, typename state_machine<T>::handler_f>;

    state_machine();
    state_machine(T initial, std::unordered_map<T, handler_f> handlers);
    state_machine(std::nullptr_t);

    void register_state(T key, handler_f handler);

    void change_state(T key);

    T const &current_state() const;
};

template <typename T>
state_machine<T> make_state_machine(T initial, typename state_machine<T>::handlers_t handlers);
}

#include "yas_state_machine_private.h"
{'fraction_non_alphanumeric': 0.1140763997906855, 'fraction_numerical': 0.0, 'mean_word_length': 4.071618037135279, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '2108412', 'n_tokens_mistral': 641, 'n_tokens_neox': 617, 'n_words': 149}