<commit_before>#ifndef KGR_KANGARU_INCLUDE_KANGARU_DETAIL_INVOKE_FUNCTION_HPP
#define KGR_KANGARU_INCLUDE_KANGARU_DETAIL_INVOKE_FUNCTION_HPP

#include "meta_list.hpp"
#include "void_t.hpp"
#include "traits.hpp"
#include "service_map.hpp"

#ifndef KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD
#if _MSC_VER == 1900
#ifndef __clang__
// MSVC has a defect that makes the use of the template keyword an error in some corner cases.
#define KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD
#endif // !__clang__
#endif // _MSC_VER
#endif // KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD

#ifndef KGR_KANGARU_MSVC_EXACT_DECLTYPE
#if _MSC_VER
#ifndef __clang__
// MSVC has a defect that makes decltype with the address of a
// generic lambda not possible unless sending the address to a function.
#define KGR_KANGARU_MSVC_EXACT_DECLTYPE
#endif // !__clang__
#endif // _MSC_VER
#endif // KGR_KANGARU_MSVC_EXACT_DECLTYPE

namespace kgr {
namespace detail {

/*
 * Checks if some given pointer to member function is invokable
 * 
 * Assumes that P is a reflectable function type.
 */
template<typename Map, typename T, typename P, typename... Args>
struct is_pointer_invokable_helper {
private:
	template<typename U, typename V, typename... As, std::size_t... S>
	static decltype(
		void((std::declval<U>().*std::declval<V>())(
			std::declval<service_type<mapped_service_t<function_argument_t<S, V>, Map>>>()...,
			std::declval<As>()...
		)), std::true_type{}
	) test(seq<S...>, int);
	
	template<typename..., typename U>
	static std::false_type test(U const&, void*);
	
public:
	using type = decltype(test<T, P, Args...>(tuple_seq_minus<function_arguments_t<P>, sizeof...(Args)>{}, 0));
};

/*
 * Alias for the is_pointer_invokable_helper trait<commit_msg>Using ... as false_type argument as other functions<commit_after>#ifndef KGR_KANGARU_INCLUDE_KANGARU_DETAIL_INVOKE_FUNCTION_HPP
#define KGR_KANGARU_INCLUDE_KANGARU_DETAIL_INVOKE_FUNCTION_HPP

#include "meta_list.hpp"
#include "void_t.hpp"
#include "traits.hpp"
#include "service_map.hpp"

#ifndef KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD
#if _MSC_VER == 1900
#ifndef __clang__
// MSVC has a defect that makes the use of the template keyword an error in some corner cases.
#define KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD
#endif // !__clang__
#endif // _MSC_VER
#endif // KGR_KANGARU_MSVC_NO_DEPENDENT_TEMPLATE_KEYWORD

#ifndef KGR_KANGARU_MSVC_EXACT_DECLTYPE
#if _MSC_VER
#ifndef __clang__
// MSVC has a defect that makes decltype with the address of a
// generic lambda not possible unless sending the address to a function.
#define KGR_KANGARU_MSVC_EXACT_DECLTYPE
#endif // !__clang__
#endif // _MSC_VER
#endif // KGR_KANGARU_MSVC_EXACT_DECLTYPE

namespace kgr {
namespace detail {

/*
 * Checks if some given pointer to member function is invokable
 * 
 * Assumes that P is a reflectable function type.
 */
template<typename Map, typename T, typename P, typename... Args>
struct is_pointer_invokable_helper {
private:
	template<typename U, typename V, typename... As, std::size_t... S>
	static decltype(
		void((std::declval<U>().*std::declval<V>())(
			std::declval<service_type<mapped_service_t<function_argument_t<S, V>, Map>>>()...,
			std::declval<As>()...
		)), std::true_type{}
	) test(seq<S...>, int);
	
	template<typename..., typename U>
	static std::false_type test(U const&, ...);
	
public:
	using type = decltype(test<T, P, Args...>(tuple_seq_minus<function_arguments_t<P>, sizeof...(Args)>{}, 0));
};

/*
 * Alias for the is_pointer_invokable_helper trait
{'fraction_non_alphanumeric': 0.11529745042492918, 'fraction_numerical': 0.0028328611898017, 'mean_word_length': 5.490808823529412, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '965488', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1286, 'n_words': 312}