<commit_before>#ifndef REGISTRY_H
#define REGISTRY_H

#include <set>

namespace sensekit {

    template<typename>
    class TrackedInstance;

    class Registry
    {
    public:
        Registry();
        virtual ~Registry();

        template<typename T>
        static T* get(void* obj);

    private:
        struct tag_ {};

        using key = std::pair<const tag_*, const void*>;
        using store = std::set<key>;

        template<typename T>
        static void register_instance(TrackedInstance<T>* instance);

        template<typename T>
        static void unregister_instance(TrackedInstance<T>* instance);

        static store& get_store();

        template<typename T>
        friend class TrackedInstance;
    };

    template<typename T>
    void Registry::register_instance(TrackedInstance<T>* instance)
    {
        if (!instance)
            return;

        const tag_* tag = &TrackedInstance<T>::TAG;
        const void* object = instance;

        get_store().insert(std::make_pair(tag, object));
    }

    template<typename T>
    void Registry::unregister_instance(TrackedInstance<T>* instance)
    {
        if (!instance)
            return;

        const tag_* tag = &TrackedInstance<T>::TAG;
        const void* object = instance;

        get_store().erase(std::make_pair(tag, object));
    }

    template<typename T>
    T* Registry::get(void* obj)
    {
        if (!obj)
            return nullptr;

        const tag_* tag = &TrackedInstance<T>::TAG;
        if (get_store().count(std::make_pair(tag, obj)) == 0)
            return nullptr;

        return static_cast<T*>(reinterpret_cast<TrackedInstance<T>*>(obj));
    }

    template<typename T>
    class TrackedInstance
    {
    public:
        TrackedInstance();
        virtual ~TrackedInstance();

        TrackedInstance(TrackedInstance&&) = default;
        TrackedInstance& operator=(TrackedInstance&&) = default;

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

    private:
        static const Registry::tag_ TAG;

        friend class Registry;

    };

    template<typename T>
    const Registry::tag_ TrackedInstance<T>::TAG{};<commit_msg>fix for visual studio 2013 lack of implicit move operations<commit_after>#ifndef REGISTRY_H
#define REGISTRY_H

#include <set>

namespace sensekit {

    template<typename>
    class TrackedInstance;

    class Registry
    {
    public:
        Registry();
        virtual ~Registry();

        template<typename T>
        static T* get(void* obj);

    private:
        struct tag_ {};

        using key = std::pair<const tag_*, const void*>;
        using store = std::set<key>;

        template<typename T>
        static void register_instance(TrackedInstance<T>* instance);

        template<typename T>
        static void unregister_instance(TrackedInstance<T>* instance);

        static store& get_store();

        template<typename T>
        friend class TrackedInstance;
    };

    template<typename T>
    void Registry::register_instance(TrackedInstance<T>* instance)
    {
        if (!instance)
            return;

        const tag_* tag = &TrackedInstance<T>::TAG;
        const void* object = instance;

        get_store().insert(std::make_pair(tag, object));
    }

    template<typename T>
    void Registry::unregister_instance(TrackedInstance<T>* instance)
    {
        if (!instance)
            return;

        const tag_* tag = &TrackedInstance<T>::TAG;
        const void* object = instance;

        get_store().erase(std::make_pair(tag, object));
    }

    template<typename T>
    T* Registry::get(void* obj)
    {
        if (!obj)
            return nullptr;

        const tag_* tag = &TrackedInstance<T>::TAG;
        if (get_store().count(std::make_pair(tag, obj)) == 0)
            return nullptr;

        return static_cast<T*>(reinterpret_cast<TrackedInstance<T>*>(obj));
    }

    template<typename T>
    class TrackedInstance
    {
    public:
        TrackedInstance();
        virtual ~TrackedInstance();

        // comment these out until we find a workaround for VS2013
        //TrackedInstance(TrackedInstance&&) = default;
        //TrackedInstance& operator=(TrackedInstance&&) = default;

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

    private:
        static const Registry::tag_ TAG;

        friend class Registry;

    };

    template<typename T>
    const Registry::tag_ TrackedInstance<T>::TAG{};
{'fraction_non_alphanumeric': 0.11065127423219343, 'fraction_numerical': 0.0021781746896101066, 'mean_word_length': 2.567987567987568, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, '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': '777416', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1257, 'n_words': 308}