<commit_before>
#pragma once

#include <utility>

////////////////////////////////////////

namespace core
{

template <class function>
class scope_guard
{
public:
	scope_guard( function f )
		: _f( std::move( f ) ), _active(true)
	{
	}

	~scope_guard( void )
	{
		if ( _active )
			_f();
	}

	void dismiss( void )
	{
		_active = false;
	}

	scope_guard( void ) = delete;

	scope_guard( const scope_guard & ) = delete;

	scope_guard &operator=( const scope_guard & ) = delete;

	scope_guard( scope_guard && rhs )
		: _f( std::move( rhs._f ) ), _active( rhs._active )
	{
		rhs.dismiss();
	}

private:
	function _f;
	bool _active;
};

namespace detail
{
	enum class scope_guardOnExit {};
	template <typename function>
	scope_guard<function> operator+( scope_guardOnExit, function &&fn )
	{
		return scope_guard<function>( std::forward<function>( fn ) );
	}
}

}

#define CONCATENATE_IMPL(s1, s2) s1##s2
#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2)
#define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __COUNTER__)

#define SCOPE_EXIT \
	auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE) = core::detail::scope_guardOnExit() + [&]()
<commit_msg>Made scope guard more readable(?)<commit_after>
#pragma once

#include <utility>

////////////////////////////////////////

namespace core
{

template <class function>
class scope_guard
{
public:
	scope_guard( function f )
		: _f( std::move( f ) ), _active(true)
	{
	}

	~scope_guard( void )
	{
		if ( _active )
			_f();
	}

	void dismiss( void )
	{
		_active = false;
	}

	scope_guard( void ) = delete;

	scope_guard( const scope_guard & ) = delete;

	scope_guard &operator=( const scope_guard & ) = delete;

	scope_guard( scope_guard && rhs )
		: _f( std::move( rhs._f ) ), _active( rhs._active )
	{
		rhs.dismiss();
	}

private:
	function _f;
	bool _active;
};

namespace detail
{
	enum class scope_guardOnExit {};
	template <typename function>
	scope_guard<function> operator+=( scope_guardOnExit, function &&fn )
	{
		return scope_guard<function>( std::forward<function>( fn ) );
	}
}

}

#define CONCATENATE_IMPL(s1, s2) s1##s2
#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2)
#define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __COUNTER__)

#define on_scope_exit \
	auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE) = core::detail::scope_guardOnExit()

{'fraction_non_alphanumeric': 0.16506550218340613, 'fraction_numerical': 0.0069868995633187774, 'mean_word_length': 3.823157894736842, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3781596', 'n_tokens_mistral': 905, 'n_tokens_neox': 862, 'n_words': 186}