rice 4.7.1 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -1
  3. data/CMakeLists.txt +14 -22
  4. data/CMakePresets.json +203 -75
  5. data/FindRuby.cmake +358 -123
  6. data/bin/rice-doc.rb +56 -141
  7. data/include/rice/api.hpp +248 -0
  8. data/include/rice/rice.hpp +2237 -1657
  9. data/include/rice/stl.hpp +346 -443
  10. data/lib/rice/doc/config.rb +70 -0
  11. data/lib/rice/doc/cpp_reference.rb +1 -4
  12. data/lib/rice/doc/mkdocs.rb +58 -20
  13. data/lib/rice/doc/rice.rb +20 -0
  14. data/lib/rice/doc.rb +1 -0
  15. data/lib/rice/make_rice_headers.rb +7 -0
  16. data/lib/rice/native_registry.rb +2 -2
  17. data/lib/rice/rbs.rb +2 -2
  18. data/lib/rice/version.rb +1 -1
  19. data/lib/rubygems_plugin.rb +12 -9
  20. data/rice/Arg.hpp +12 -6
  21. data/rice/Arg.ipp +14 -7
  22. data/rice/Buffer.ipp +44 -40
  23. data/rice/Callback.hpp +1 -1
  24. data/rice/Callback.ipp +2 -7
  25. data/rice/Constructor.hpp +1 -1
  26. data/rice/Constructor.ipp +11 -11
  27. data/rice/Data_Object.ipp +15 -15
  28. data/rice/Data_Type.hpp +9 -10
  29. data/rice/Data_Type.ipp +22 -25
  30. data/rice/Director.hpp +1 -0
  31. data/rice/Enum.ipp +58 -39
  32. data/rice/Exception.hpp +4 -4
  33. data/rice/Exception.ipp +7 -7
  34. data/rice/NoGVL.hpp +13 -0
  35. data/rice/Reference.hpp +56 -0
  36. data/rice/Reference.ipp +96 -0
  37. data/rice/Return.hpp +4 -1
  38. data/rice/Return.ipp +0 -6
  39. data/rice/cpp_api/Array.hpp +41 -4
  40. data/rice/cpp_api/Array.ipp +105 -9
  41. data/rice/cpp_api/Class.hpp +2 -2
  42. data/rice/cpp_api/Class.ipp +4 -4
  43. data/rice/cpp_api/Hash.ipp +7 -4
  44. data/rice/cpp_api/Module.hpp +4 -4
  45. data/rice/cpp_api/Module.ipp +12 -10
  46. data/rice/cpp_api/Object.hpp +4 -4
  47. data/rice/cpp_api/Object.ipp +15 -12
  48. data/rice/cpp_api/String.hpp +2 -2
  49. data/rice/cpp_api/String.ipp +11 -8
  50. data/rice/cpp_api/Symbol.ipp +7 -7
  51. data/rice/cpp_api/shared_methods.hpp +5 -9
  52. data/rice/detail/InstanceRegistry.hpp +0 -2
  53. data/rice/detail/Native.hpp +31 -21
  54. data/rice/detail/Native.ipp +282 -130
  55. data/rice/detail/NativeAttributeGet.hpp +5 -7
  56. data/rice/detail/NativeAttributeGet.ipp +26 -26
  57. data/rice/detail/NativeAttributeSet.hpp +2 -4
  58. data/rice/detail/NativeAttributeSet.ipp +20 -16
  59. data/rice/detail/NativeCallback.hpp +77 -0
  60. data/rice/detail/NativeCallback.ipp +280 -0
  61. data/rice/detail/NativeFunction.hpp +11 -21
  62. data/rice/detail/NativeFunction.ipp +58 -119
  63. data/rice/detail/NativeInvoker.hpp +4 -4
  64. data/rice/detail/NativeInvoker.ipp +7 -7
  65. data/rice/detail/NativeIterator.hpp +2 -4
  66. data/rice/detail/NativeIterator.ipp +18 -14
  67. data/rice/detail/NativeMethod.hpp +10 -20
  68. data/rice/detail/NativeMethod.ipp +54 -114
  69. data/rice/detail/NativeProc.hpp +5 -7
  70. data/rice/detail/NativeProc.ipp +39 -28
  71. data/rice/detail/NativeRegistry.hpp +0 -1
  72. data/rice/detail/Parameter.hpp +15 -8
  73. data/rice/detail/Parameter.ipp +102 -43
  74. data/rice/detail/Proc.ipp +14 -28
  75. data/rice/detail/RubyType.ipp +2 -53
  76. data/rice/detail/Type.hpp +23 -7
  77. data/rice/detail/Type.ipp +73 -93
  78. data/rice/detail/TypeRegistry.ipp +5 -4
  79. data/rice/detail/Wrapper.hpp +1 -1
  80. data/rice/detail/Wrapper.ipp +18 -10
  81. data/rice/detail/from_ruby.hpp +8 -6
  82. data/rice/detail/from_ruby.ipp +306 -173
  83. data/rice/detail/ruby.hpp +23 -0
  84. data/rice/libc/file.hpp +4 -4
  85. data/rice/rice.hpp +6 -8
  86. data/rice/rice_api/Native.ipp +5 -1
  87. data/rice/rice_api/Parameter.ipp +1 -1
  88. data/rice/ruby_mark.hpp +2 -1
  89. data/rice/stl/complex.ipp +12 -8
  90. data/rice/stl/map.ipp +27 -22
  91. data/rice/stl/monostate.ipp +16 -12
  92. data/rice/stl/multimap.hpp +0 -2
  93. data/rice/stl/multimap.ipp +27 -22
  94. data/rice/stl/optional.ipp +27 -11
  95. data/rice/stl/pair.ipp +5 -5
  96. data/rice/stl/reference_wrapper.ipp +5 -4
  97. data/rice/stl/set.ipp +16 -16
  98. data/rice/stl/shared_ptr.hpp +0 -16
  99. data/rice/stl/shared_ptr.ipp +34 -190
  100. data/rice/stl/string.ipp +18 -18
  101. data/rice/stl/string_view.ipp +1 -1
  102. data/rice/stl/tuple.ipp +15 -36
  103. data/rice/stl/unique_ptr.ipp +18 -8
  104. data/rice/stl/unordered_map.ipp +20 -15
  105. data/rice/stl/variant.ipp +37 -21
  106. data/rice/stl/vector.ipp +41 -36
  107. data/rice/traits/function_traits.hpp +19 -19
  108. data/rice/traits/method_traits.hpp +4 -4
  109. data/rice/traits/rice_traits.hpp +162 -39
  110. data/rice.gemspec +1 -3
  111. data/test/test_Array.cpp +261 -3
  112. data/test/test_Attribute.cpp +6 -3
  113. data/test/test_Buffer.cpp +6 -42
  114. data/test/test_Callback.cpp +77 -23
  115. data/test/test_Data_Object.cpp +1 -1
  116. data/test/test_Data_Type.cpp +21 -22
  117. data/test/test_Director.cpp +2 -4
  118. data/test/test_Enum.cpp +34 -5
  119. data/test/test_File.cpp +9 -5
  120. data/test/test_From_Ruby.cpp +4 -3
  121. data/test/test_GVL.cpp +3 -3
  122. data/test/test_Hash.cpp +1 -1
  123. data/test/test_Iterator.cpp +54 -22
  124. data/test/test_Keep_Alive.cpp +1 -1
  125. data/test/test_Keep_Alive_No_Wrapper.cpp +1 -1
  126. data/test/test_Module.cpp +5 -5
  127. data/test/test_Overloads.cpp +345 -48
  128. data/test/test_Proc.cpp +54 -0
  129. data/test/test_Reference.cpp +181 -0
  130. data/test/test_Self.cpp +2 -2
  131. data/test/test_Stl_Set.cpp +6 -6
  132. data/test/test_Stl_SharedPtr.cpp +54 -30
  133. data/test/test_Stl_String_View.cpp +4 -2
  134. data/test/test_Stl_Tuple.cpp +1 -1
  135. data/test/test_Stl_Variant.cpp +6 -14
  136. data/test/test_Stl_Vector.cpp +61 -30
  137. data/test/test_String.cpp +4 -2
  138. data/test/test_Struct.cpp +1 -1
  139. data/test/test_Symbol.cpp +1 -1
  140. data/test/test_To_Ruby.cpp +1 -0
  141. data/test/test_Type.cpp +36 -35
  142. data/test/test_global_functions.cpp +1 -1
  143. data/test/unittest.cpp +1 -1
  144. data/test/unittest.hpp +5 -5
  145. metadata +10 -10
  146. data/rice/Function.hpp +0 -17
  147. data/rice/Function.ipp +0 -13
  148. data/rice/detail/MethodInfo.hpp +0 -48
  149. data/rice/detail/MethodInfo.ipp +0 -99
  150. data/rice/detail/NativeCallbackFFI.hpp +0 -55
  151. data/rice/detail/NativeCallbackFFI.ipp +0 -152
  152. data/rice/detail/NativeCallbackSimple.hpp +0 -30
  153. data/rice/detail/NativeCallbackSimple.ipp +0 -29
@@ -1,99 +0,0 @@
1
- #include <sstream>
2
-
3
- namespace Rice
4
- {
5
- template <typename...Arg_Ts>
6
- inline MethodInfo::MethodInfo(size_t argCount, const Arg_Ts&...args)
7
- {
8
- // Process the passed in arguments
9
- (this->processArg(args), ...);
10
-
11
- // Fill in any missing arguments
12
- for (size_t i = this->args_.size(); i < argCount; i++)
13
- {
14
- Arg arg("arg_" + std::to_string(i));
15
- this->addArg(arg);
16
- }
17
-
18
- // TODO - so hacky but update the Arg positions
19
- for (uint32_t i = 0; i < this->args_.size(); i++)
20
- {
21
- this->args_[i].position = i;
22
- }
23
- }
24
-
25
- template <typename Arg_T>
26
- inline void MethodInfo::processArg(const Arg_T& arg)
27
- {
28
- if constexpr (std::is_same_v<Arg_T, Return>)
29
- {
30
- this->returnInfo_ = arg;
31
- }
32
- else if constexpr (std::is_same_v<Arg_T, Function>)
33
- {
34
- this->function_ = arg;
35
- }
36
- else if constexpr (std::is_same_v<Arg_T, Arg>)
37
- {
38
- this->addArg(arg);
39
- }
40
- else
41
- {
42
- static_assert(true, "Unknown argument type");
43
- }
44
- }
45
-
46
- inline void MethodInfo::addArg(const Arg& arg)
47
- {
48
- this->args_.push_back(arg);
49
- }
50
-
51
- inline int MethodInfo::argCount()
52
- {
53
- return this->args_.size();
54
- }
55
-
56
- inline Arg* MethodInfo::arg(size_t pos)
57
- {
58
- if (pos < this->args_.size())
59
- {
60
- return &this->args_[pos];
61
- }
62
- else
63
- {
64
- return nullptr;
65
- }
66
- }
67
-
68
- inline Arg* MethodInfo::arg(std::string name)
69
- {
70
- for (Arg& arg : this->args_)
71
- {
72
- if (arg.name == name)
73
- {
74
- return &arg;
75
- }
76
- }
77
- return nullptr;
78
- }
79
-
80
- inline Return* MethodInfo::returnInfo()
81
- {
82
- return &this->returnInfo_;
83
- }
84
-
85
- inline Function* MethodInfo::function()
86
- {
87
- return &this->function_;
88
- }
89
-
90
- inline std::vector<Arg>::iterator MethodInfo::begin()
91
- {
92
- return this->args_.begin();
93
- }
94
-
95
- inline std::vector<Arg>::iterator MethodInfo::end()
96
- {
97
- return this->args_.end();
98
- }
99
- }
@@ -1,55 +0,0 @@
1
- #ifndef Rice__detail__Native_Callback_Ffi_hpp_
2
- #define Rice__detail__Native_Callback_Ffi_hpp_
3
-
4
- #ifdef HAVE_LIBFFI
5
-
6
- #include <ffi.h>
7
-
8
- namespace Rice::detail
9
- {
10
- template<typename Callback_T>
11
- class NativeCallbackFFI;
12
-
13
- template<typename Return_T, typename ...Arg_Ts>
14
- class NativeCallbackFFI<Return_T(*)(Arg_Ts...)>
15
- {
16
- public:
17
- using Callback_T = Return_T(Arg_Ts...);
18
- using Tuple_T = std::tuple<Arg_Ts...>;
19
- static void ffiCallback(ffi_cif* cif, void* ret, void* args[], void* instance);
20
- static VALUE finalizerCallback(VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE* argv, VALUE blockarg);
21
- static void setMethodInfo(MethodInfo* methodInfo);
22
-
23
- public:
24
- NativeCallbackFFI(VALUE proc);
25
- ~NativeCallbackFFI();
26
- NativeCallbackFFI(const NativeCallbackFFI&) = delete;
27
- NativeCallbackFFI(NativeCallbackFFI&&) = delete;
28
- void operator=(const NativeCallbackFFI&) = delete;
29
- void operator=(NativeCallbackFFI&&) = delete;
30
-
31
- Return_T operator()(Arg_Ts...args);
32
- Callback_T* callback();
33
-
34
- private:
35
- template <typename Arg_T>
36
- static ffi_type* ffiType();
37
-
38
- template<std::size_t... I>
39
- static Tuple_T convertArgsToTuple(void* args[], std::index_sequence<I...>& indices);
40
-
41
- static inline std::array<ffi_type*, sizeof...(Arg_Ts)> args_ = { ffiType<Arg_Ts>()... };
42
- static inline ffi_cif cif_;
43
- static inline ffi_closure* closure_ = nullptr;
44
- static inline Callback_T* callback_ = nullptr;
45
- static inline std::unique_ptr<MethodInfo> methodInfo_ = std::make_unique<MethodInfo>();
46
-
47
- template<std::size_t... I>
48
- Return_T callRuby(std::index_sequence<I...>& indices, Arg_Ts...args);
49
- private:
50
- VALUE proc_;
51
- };
52
- }
53
- #endif // HAVE_LIBFFI
54
-
55
- #endif // Rice__detail__Native_Callback_Ffi_hpp_
@@ -1,152 +0,0 @@
1
- #ifdef HAVE_LIBFFI
2
- #include <tuple>
3
- #include <ffi.h>
4
-
5
- namespace Rice::detail
6
- {
7
- template<typename Return_T, typename ...Arg_Ts>
8
- template<typename Arg_T>
9
- ffi_type* NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::ffiType()
10
- {
11
- std::map<std::type_index, ffi_type*> nativeToFfiMapping = {
12
- {std::type_index(typeid(bool)), &ffi_type_uint8},
13
- {std::type_index(typeid(bool)), &ffi_type_uint8},
14
- {std::type_index(typeid(char)), &ffi_type_schar},
15
- {std::type_index(typeid(unsigned char)), &ffi_type_uchar},
16
- {std::type_index(typeid(signed char)), &ffi_type_schar},
17
- {std::type_index(typeid(uint8_t)), &ffi_type_uint8},
18
- {std::type_index(typeid(unsigned short)), &ffi_type_uint8},
19
- {std::type_index(typeid(int8_t)), &ffi_type_sint8},
20
- {std::type_index(typeid(short)), &ffi_type_sint8},
21
- {std::type_index(typeid(uint16_t)), &ffi_type_uint16},
22
- {std::type_index(typeid(int16_t)), &ffi_type_sint16},
23
- {std::type_index(typeid(uint32_t)), &ffi_type_uint32},
24
- {std::type_index(typeid(unsigned int)), &ffi_type_uint32},
25
- {std::type_index(typeid(signed int)), &ffi_type_uint32},
26
- {std::type_index(typeid(int32_t)), &ffi_type_sint32},
27
- {std::type_index(typeid(uint64_t)), &ffi_type_uint64},
28
- {std::type_index(typeid(unsigned long long)), &ffi_type_uint64},
29
- {std::type_index(typeid(int64_t)), &ffi_type_sint64},
30
- {std::type_index(typeid(signed long long)), &ffi_type_sint64},
31
- {std::type_index(typeid(float)), &ffi_type_float},
32
- {std::type_index(typeid(double)), &ffi_type_double},
33
- {std::type_index(typeid(void)), &ffi_type_pointer},
34
- {std::type_index(typeid(long double)), &ffi_type_longdouble}
35
- };
36
-
37
- if (sizeof(long) == 32)
38
- {
39
- nativeToFfiMapping[std::type_index(typeid(unsigned long))] = &ffi_type_uint32;
40
- nativeToFfiMapping[std::type_index(typeid(long))] = &ffi_type_sint32;
41
- }
42
- else if (sizeof(long) == 64)
43
- {
44
- nativeToFfiMapping[std::type_index(typeid(unsigned long))] = &ffi_type_uint64;
45
- nativeToFfiMapping[std::type_index(typeid(long))] = &ffi_type_sint64;
46
- }
47
-
48
- if (std::is_pointer_v<Arg_T>)
49
- {
50
- return &ffi_type_pointer;
51
- }
52
- else
53
- {
54
- const std::type_index& key = std::type_index(typeid(Arg_T));
55
- return nativeToFfiMapping[key];
56
- }
57
- }
58
-
59
- template<typename Return_T, typename ...Arg_Ts>
60
- template<std::size_t... I>
61
- typename NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::Tuple_T NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::convertArgsToTuple(void* args[], std::index_sequence<I...>& indices)
62
- {
63
- /* Loop over each value returned from Ruby and convert it to the appropriate C++ type based
64
- on the arguments (Arg_Ts) required by the C++ function. Arg_T may have const/volatile while
65
- the associated From_Ruby<T> template parameter will not. Thus From_Ruby produces non-const values
66
- which we let the compiler convert to const values as needed. This works except for
67
- T** -> const T**, see comment in convertToNative method. */
68
- return std::forward_as_tuple(*(std::tuple_element_t<I, Tuple_T>*)(args[I])...);
69
- }
70
-
71
- template<typename Return_T, typename ...Arg_Ts>
72
- void NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::ffiCallback(ffi_cif* cif, void* ret, void* args[], void* instance)
73
- {
74
- using Self_T = NativeCallbackFFI<Return_T(*)(Arg_Ts...)>;
75
- Self_T* self = (Self_T*)instance;
76
-
77
- auto indices = std::make_index_sequence<sizeof...(Arg_Ts)>{};
78
-
79
- if constexpr (sizeof...(Arg_Ts) == 0)
80
- {
81
- *(Return_T*)ret = self->operator()();
82
- }
83
- else
84
- {
85
- std::tuple<Arg_Ts...> tuple = convertArgsToTuple(args, indices);
86
- *(Return_T*)ret = std::apply(*self, tuple);
87
- }
88
- }
89
-
90
- template<typename Return_T, typename ...Arg_Ts>
91
- void NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::setMethodInfo(MethodInfo* methodInfo)
92
- {
93
- methodInfo_.reset(methodInfo);
94
- }
95
-
96
- template<typename Return_T, typename ...Arg_Ts>
97
- NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::~NativeCallbackFFI()
98
- {
99
- this->proc_ = Qnil;
100
- }
101
-
102
- template<typename Return_T, typename ...Arg_Ts>
103
- VALUE NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::finalizerCallback(VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE* argv, VALUE blockarg)
104
- {
105
- using NativeCallback_T = NativeCallbackFFI<Return_T(*)(Arg_Ts...)>;
106
- NativeCallback_T* nativeCallback = (NativeCallback_T*)callback_arg;
107
- delete nativeCallback;
108
- return Qnil;
109
- }
110
-
111
- template<typename Return_T, typename ...Arg_Ts>
112
- NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::NativeCallbackFFI(VALUE proc) : proc_(proc)
113
- {
114
- // First setup desccription of callback
115
- if (cif_.bytes == 0)
116
- {
117
- ffi_prep_cif(&cif_, FFI_DEFAULT_ABI, sizeof...(Arg_Ts), &ffi_type_pointer, args_.data());
118
- }
119
-
120
- // Create FFI closure
121
- this->closure_ = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure) + sizeof(void*), (void**)(&this->callback_));
122
- ffi_prep_closure_loc(this->closure_, &cif_, ffiCallback, (void*)this, (void*)this->callback_);
123
- }
124
-
125
- template<typename Return_T, typename ...Arg_Ts>
126
- typename NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::Callback_T* NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::callback()
127
- {
128
- return (Callback_T*)this->callback_;
129
- }
130
-
131
- template<typename Return_T, typename ...Arg_Ts>
132
- template<std::size_t... I>
133
- Return_T NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::callRuby(std::index_sequence<I...>& indices, Arg_Ts...args)
134
- {
135
- static Identifier id("call");
136
- std::array<VALUE, sizeof...(Arg_Ts)> values = { detail::To_Ruby<detail::remove_cv_recursive_t<Arg_Ts>>(methodInfo_->arg(I)).convert(args)... };
137
- VALUE result = detail::protect(rb_funcallv, this->proc_, id.id(), (int)sizeof...(Arg_Ts), values.data());
138
- if constexpr (!std::is_void_v<Return_T>)
139
- {
140
- static From_Ruby<Return_T> fromRuby(dynamic_cast<Arg*>(methodInfo_->returnInfo()));
141
- return fromRuby.convert(result);
142
- }
143
- }
144
-
145
- template<typename Return_T, typename ...Arg_Ts>
146
- Return_T NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::operator()(Arg_Ts...args)
147
- {
148
- auto indices = std::make_index_sequence<sizeof...(Arg_Ts)>{};
149
- return NativeCallbackFFI<Return_T(*)(Arg_Ts...)>::callRuby(indices, args...);
150
- }
151
- }
152
- #endif // HAVE_LIBFFI
@@ -1,30 +0,0 @@
1
- #ifndef Rice__detail__Native_Callback_Simple_hpp_
2
- #define Rice__detail__Native_Callback_Simple_hpp_
3
-
4
- namespace Rice::detail
5
- {
6
- template<typename Callback_T>
7
- class NativeCallbackSimple;
8
-
9
- template<typename Return_T, typename ...Arg_Ts>
10
- class NativeCallbackSimple<Return_T(*)(Arg_Ts...)>
11
- {
12
- public:
13
- static Return_T callback(Arg_Ts...args);
14
- static inline VALUE proc = Qnil;
15
- static void setMethodInfo(MethodInfo* methodInfo);
16
-
17
- public:
18
- NativeCallbackSimple() = delete;
19
- NativeCallbackSimple(const NativeCallbackSimple&) = delete;
20
- NativeCallbackSimple(NativeCallbackSimple&&) = delete;
21
- void operator=(const NativeCallbackSimple&) = delete;
22
- void operator=(NativeCallbackSimple&&) = delete;
23
-
24
- private:
25
- template<std::size_t... I>
26
- static Return_T callRuby(std::index_sequence<I...>& indices, Arg_Ts...args);
27
- static inline std::unique_ptr<MethodInfo> methodInfo_ = std::make_unique<MethodInfo>();
28
- };
29
- }
30
- #endif // Rice__detail__Native_Callback_Simple_hpp_
@@ -1,29 +0,0 @@
1
- namespace Rice::detail
2
- {
3
- template<typename Return_T, typename ...Arg_Ts>
4
- void NativeCallbackSimple<Return_T(*)(Arg_Ts...)>::setMethodInfo(MethodInfo* methodInfo)
5
- {
6
- methodInfo_.reset(methodInfo);
7
- }
8
-
9
- template<typename Return_T, typename ...Arg_Ts>
10
- template<std::size_t... I>
11
- Return_T NativeCallbackSimple<Return_T(*)(Arg_Ts...)>::callRuby(std::index_sequence<I...>& indices, Arg_Ts...args)
12
- {
13
- static Identifier id("call");
14
- std::array<VALUE, sizeof...(Arg_Ts)> values = { detail::To_Ruby<detail::remove_cv_recursive_t<Arg_Ts>>(methodInfo_->arg(I)).convert(args)... };
15
- VALUE result = detail::protect(rb_funcallv, proc, id.id(), (int)sizeof...(Arg_Ts), values.data());
16
- if constexpr (!std::is_void_v<Return_T>)
17
- {
18
- static From_Ruby<Return_T> fromRuby(dynamic_cast<Arg*>(methodInfo_->returnInfo()));
19
- return fromRuby.convert(result);
20
- }
21
- }
22
-
23
- template<typename Return_T, typename ...Arg_Ts>
24
- Return_T NativeCallbackSimple<Return_T(*)(Arg_Ts...)>::callback(Arg_Ts...args)
25
- {
26
- auto indices = std::make_index_sequence<sizeof...(Arg_Ts)>{};
27
- return NativeCallbackSimple<Return_T(*)(Arg_Ts...)>::callRuby(indices, args...);
28
- }
29
- }