<commit_before>#ifndef MEMBERDELEGATE_HPP
# define MEMBERDELEGATE_HPP
# pragma once

#include <type_traits>

namespace generic
{

#ifndef DELEGATE
# define DELEGATE(f) decltype(&f),&f
#endif // DELEGATE

namespace detail
{

template <typename T>
auto address(T&& t) -> typename ::std::remove_reference<T>::type*
{
  return &t;
}

template <typename FP, FP fp, class C, typename ...A>
struct S
{
  static constexpr auto* l = false ?
    address([](C* const object) noexcept {
      return [object](A&& ...args) {
        return (object->*fp)(::std::forward<A>(args)...); 
      };
    }) :
    nullptr;
};

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...) const) ->
  decltype((*decltype(S<FP, fp, C, A...>::l)(nullptr))(object))
{
  return (*decltype(S<FP, fp, C, A...>::l)(nullptr))(object);
}

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...) const volatile) ->
  decltype((*decltype(S<FP, fp, C, A...>::l)(nullptr))(object))
{
  return (*decltype(S<FP, fp, C, A...>::l)(nullptr))(object);
}

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...) volatile) ->
  decltype((*decltype(S<FP, fp, C, A...>::l)(nullptr))(object))
{
  return (*decltype(S<FP, fp, C, A...>::l)(nullptr))(object);
}

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...)) ->
  decltype((*decltype(S<FP, fp, C, A...>::l)(nullptr))(object))
{
  return (*decltype(S<FP, fp, C, A...>::l)(nullptr))(object);
}

}

template <typename FP, FP fp, class C>
auto make_delegate(C* const object) ->
  decltype(detail::make_delegate<FP, fp>(object, fp))
{
  return detail::make_delegate<FP, fp>(object, fp);
}

}

#endif // MEMBERDELEGATE_HPP
<commit_msg>some fixes<commit_after>#ifndef MEMBERDELEGATE_HPP
# define MEMBERDELEGATE_HPP
# pragma once

#include <type_traits>

namespace generic
{

#ifndef MEMBER
# define MEMBER(f) decltype(&f),&f
#endif // MEMBER

namespace detail
{

template <typename FP, FP fp, class C, typename ...A>
struct member_delegate
{
  C* const object;

  auto operator()(A&& ...args) const ->
    decltype((object->*fp)(::std::forward<A>(args)...))
  {
    return (object->*fp)(::std::forward<A>(args)...);
  }
};

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...) const) ->
  member_delegate<FP, fp, C, A...>
{
  return {object};
}

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...) const volatile) ->
  member_delegate<FP, fp, C, A...>
{
  return {object};
}

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...) volatile) ->
  member_delegate<FP, fp, C, A...>
{
  return {object};
}

template <typename FP, FP fp, typename R, class C, typename ...A>
auto make_delegate(C* const object, R (C::* const)(A...)) ->
  member_delegate<FP, fp, C, A...>
{
  return {object};
}

}

template <typename FP, FP fp, class C>
auto make_delegate(C* const object) ->
  decltype(detail::make_delegate<FP, fp>(object, fp))
{
  return detail::make_delegate<FP, fp>(object, fp);
}

template <typename FP, FP fp, class C>
auto make_delegate(C& object) ->
  decltype(detail::make_delegate<FP, fp>(&object, fp))
{
  return detail::make_delegate<FP, fp>(&object, fp);
}

template <typename FP, FP fp, class C>
auto make_delegate(C const* const object) ->
  decltype(detail::make_delegate<FP, fp>(object, fp))
{
  return detail::make_delegate<FP, fp>(object, fp);
}

template <typename FP, FP fp, class C>
auto make_delegate(C const& object) ->
  decltype(detail::make_delegate<FP, fp>(&object, fp))
{
  return detail::make_delegate<FP, fp>(&object, fp);
}

}

#endif // MEMBERDELEGATE_HPP

{'fraction_non_alphanumeric': 0.1959101237061348, 'fraction_numerical': 0.0, 'mean_word_length': 4.325268817204301, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 65, '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': '187990', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1435, 'n_words': 402}