@@ -178,6 +178,44 @@ struct modular_curves_submember_input_full : public modular_curves_submember_inp
178178 }
179179};
180180
181+ template <const auto & global, auto ... grabbers>
182+ struct modular_curves_global_submember_input {
183+ protected:
184+ template <typename result_type>
185+ static inline float number_to_float (const result_type& number) {
186+ // if constexpr(std::is_same_v<std::decay_t<result_type>, fix>) // TODO: Make sure we can differentiate fixes from ints.
187+ // return f2fl(number);
188+ // else
189+ if constexpr (std::is_integral_v<std::decay_t <result_type>>)
190+ return static_cast <float >(number);
191+ else if constexpr (std::is_floating_point_v<std::decay_t <result_type>>)
192+ return static_cast <float >(number);
193+ else {
194+ static_assert (!std::is_same_v<result_type, result_type>, " Tried to return non-numeric value" );
195+ return 0 .f ;
196+ }
197+ }
198+
199+ public:
200+ template <int /* tuple_idx*/ , typename input_type>
201+ static inline float grab (const input_type& /* input*/ ) {
202+ if constexpr (sizeof ...(grabbers) == 0 ) {
203+ if constexpr (std::is_invocable_v<std::decay_t <decltype (global)>>) {
204+ return number_to_float (global ());
205+ } else {
206+ return number_to_float (global);
207+ }
208+ }
209+ else {
210+ if constexpr (std::is_invocable_v<std::decay_t <decltype (global)>>) {
211+ return modular_curves_submember_input<grabbers...>::template grab<-1 , decltype (global ())>(global ());
212+ } else {
213+ return modular_curves_submember_input<grabbers...>::template grab<-1 , std::decay_t <decltype (global)>>(global);
214+ }
215+ }
216+ }
217+ };
218+
181219template <auto grabber_fnc>
182220struct modular_curves_functional_input {
183221 private:
@@ -227,7 +265,7 @@ enum class ModularCurvesMathOperators {
227265 addition,
228266 subtraction,
229267 multiplication,
230- division,
268+ division
231269};
232270
233271template <typename first, typename second, auto operation>
0 commit comments