<commit_before>/*
* handy.h
*
*  Created on: Feb 04, 2014
*      Author: Jakub 'kuhar' Kuderski
*/

/* INFO:
*  Bunch of uncategorized utils
*/

#pragma once

#include <type_traits>
#include <vector>
#include <array>
#include <cassert>

namespace kmu
{

	namespace impl // Implementation
	{
		template <size_t... Index>
		struct x_index_tuple_type
		{
			template<size_t N>
			using append = x_index_tuple_type<Index..., N>;
		};

		template<size_t N>
		struct x_make_index
		{
			using type = typename x_make_index<N - 1>::type::template append<N - 1>;
		};

		template<>
		struct x_make_index<0>
		{
			using type = x_index_tuple_type<>;
		};

		template<size_t N>
		using x_index_tuple = typename x_make_index<N>::type;

		template<typename Signature> // GCC's implementation
		class x_result_of;

		template<typename Functor, typename... ArgTypes>
		struct x_result_of<Functor( ArgTypes... )>
		{
			typedef decltype( std::declval<Functor>()( std::declval<ArgTypes>()... ) ) type;
		};

		template<int FirstValue, int SecondValue = 0>
		struct x_distance
		{
			enum
			{
				value = ( FirstValue - SecondValue ) < 0 ? 
				-( FirstValue - SecondValue ) : ( FirstValue - SecondValue )
			};
		};

	} // namespace impl

	template<typename T>
	std::vector<T> makeVectorOfElements( const T& element, size_t count = 1 )
	{
		return std::vector<T>( count, element );
	}

	template<int From, int To,
		size_t Count = ( size_t ) impl::x_distance<From, To>::value + 1><commit_msg>removal of excessive tuple_index<commit_after>/*
* handy.h
*
*  Created on: Feb 04, 2014
*      Author: Jakub 'kuhar' Kuderski
*/

/* INFO:
*  Bunch of uncategorized utils
*/

#pragma once

#include <type_traits>
#include <vector>
#include <array>
#include <cassert>

namespace kmu
{

	namespace impl // Implementation
	{

		template<typename Signature> // GCC's implementation
		class x_result_of;

		template<typename Functor, typename... ArgTypes>
		struct x_result_of<Functor( ArgTypes... )>
		{
			typedef decltype( std::declval<Functor>()( std::declval<ArgTypes>()... ) ) type;
		};

		template<int FirstValue, int SecondValue = 0>
		struct x_distance
		{
			enum
			{
				value = ( FirstValue - SecondValue ) < 0 ? 
				-( FirstValue - SecondValue ) : ( FirstValue - SecondValue )
			};
		};

	} // namespace impl

	template<typename T>
	std::vector<T> makeVectorOfElements( const T& element, size_t count = 1 )
	{
		return std::vector<T>( count, element );
	}

	template<int From, int To,
		size_t Count = ( size_t ) impl::x_distance<From, To>::value + 1>
{'fraction_non_alphanumeric': 0.1354864119732178, 'fraction_numerical': 0.009058684521465145, 'mean_word_length': 3.511545293072824, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 44, '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': '6209525', 'n_tokens_mistral': 1007, 'n_tokens_neox': 883, 'n_words': 218}