| 89 | namespace Rcpp { |
| 90 | template <typename RESULT_TYPE, typename... T> |
| 91 | inline void signature(std::string& s, const char* name) { |
| 92 | s.clear(); |
| 93 | s += get_return_type<RESULT_TYPE>() + " " + name + "("; |
| 94 | int n = sizeof...(T); |
| 95 | int i = 0; |
| 96 | // Using initializer list as c++11 implementation of a fold expression |
| 97 | (void)std::initializer_list<int>{ |
| 98 | (s += get_return_type<T>(), s += (++i == n ? "" : ", "), 0)... }; |
| 99 | s += ")"; |
| 100 | } |
| 101 | |
| 102 | template <typename RESULT_TYPE, typename... T> |
| 103 | class CppFunctionN : public CppFunction { |