@@ -20,12 +20,12 @@ class CachedFunc : public Function {
2020 template <typename ... Args>
2121 auto operator ()(Args&&... args) const
2222 {
23- return fast_invoker (Function::operator ()(std::forward<Args>(args)...), std::forward<Args>(args)...);
23+ return _fast_invoker (Function::operator ()(std::forward<Args>(args)...), std::forward<Args>(args)...);
2424 }
2525
26- protected :
26+ private :
2727 template <typename ... Args>
28- auto fast_invoker (SEXP closure, Args&&... args) const
28+ auto _fast_invoker (SEXP closure, Args&&... args) const
2929 {
3030#if defined(R_VERSION) && R_VERSION >= R_Version(4, 5, 0)
3131 Shield<SEXP > closure_formals (R_ClosureFormals (closure)), closure_body (R_ClosureBody (closure)), closure_envir (R_ClosureEnv (closure));
@@ -96,22 +96,15 @@ SEXP ksample_pmt(
9696 impl_ksample_pmt<false , CachedFunc<double >>(data, clone (group), statistic_func, n_permu);
9797}
9898
99- #include " pmt/impl_multcomp_pmt.hpp"
100-
101- template <typename T>
10299class MultcompFunc : public CachedFunc <SEXP > {
103100public:
104101 using CachedFunc<SEXP >::CachedFunc;
105102
106103 template <typename ... Args>
107104 auto operator ()(Args&&... args) const
108105 {
109- return [statistic_closure = CachedFunc<SEXP >::operator ()(std::forward<Args>(args)...), i = RObject (Rf_allocVector (INTSXP , 1 )), j = RObject (Rf_allocVector (INTSXP , 1 )), this ](auto &&...) {
110- return [pairwise_closure = this ->fast_invoker (statistic_closure (), i, j), i_ptr = INTEGER (i), j_ptr = INTEGER (j)](int i, int j) {
111- *i_ptr = i;
112- *j_ptr = j;
113- return as<T>(pairwise_closure ());
114- };
106+ return [statistic_closure = CachedFunc<SEXP >::operator ()(std::forward<Args>(args)...)](auto &&... args) {
107+ return REAL (statistic_closure (std::forward<decltype (args)>(args)...));
115108 };
116109 }
117110};
@@ -125,8 +118,8 @@ SEXP multcomp_pmt(
125118 const bool progress)
126119{
127120 return progress ?
128- impl_multcomp_pmt<true , MultcompFunc< double > >(data, clone (group), statistic_func, n_permu) :
129- impl_multcomp_pmt<false , MultcompFunc< double > >(data, clone (group), statistic_func, n_permu);
121+ impl_multcomp_pmt<true , MultcompFunc>(data, clone (group), statistic_func, n_permu) :
122+ impl_multcomp_pmt<false , MultcompFunc>(data, clone (group), statistic_func, n_permu);
130123}
131124
132125#include " pmt/impl_paired_pmt.hpp"
0 commit comments