File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ namespace mgis::function {
1616 requires (N > 0 ) //
1717 constexpr bool FixedSizeModifier<EvaluatorType, N>::checkPreconditions(
1818 AbstractErrorHandler& eh, const EvaluatorType& values) {
19- if (values. getNumberOfComponents ( ) != N) {
19+ if (internals::disambiguateGetNumberOfComponents (values ) != N) {
2020 return eh.registerErrorMessage (" invalid number of components" );
2121 }
2222 return true ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ namespace mgis::function {
1616 requires (N > 0 ) //
1717 constexpr bool FixedSizeView<FunctionType, N>::checkPreconditions(
1818 AbstractErrorHandler& eh, const FunctionType& values) {
19- if (values. getNumberOfComponents ( ) != N) {
19+ if (internals::disambiguateGetNumberOfComponents (values ) != N) {
2020 return eh.registerErrorMessage (" invalid number of components" );
2121 }
2222 return true ;
Original file line number Diff line number Diff line change @@ -234,6 +234,9 @@ namespace mgis::function {
234234 concept FunctionConcept =
235235 (SpaceConcept<
236236 std::decay_t <decltype (getSpace(std::declval<FunctionType>()))>>)&& //
237+ (requires (const FunctionType& e) {
238+ { getNumberOfComponents (e) } -> std::same_as<mgis::size_type>;
239+ }) &&
237240 ((internals::FunctionResultQuery<FunctionType>::b1) ||
238241 (internals::FunctionResultQuery<FunctionType>::b2) ||
239242 (internals::FunctionResultQuery<FunctionType>::b3) ||
@@ -341,6 +344,14 @@ namespace mgis::function {
341344 template <FunctionConcept FunctionType>
342345 constexpr decltype (auto ) disambiguateGetSpace(const FunctionType&) //
343346 requires(!EvaluatorConcept<FunctionType>);
347+ /* !
348+ * This helper function allows to disambiguate the call to
349+ * the getNumberOfComponents function
350+ */
351+ template <FunctionConcept FunctionType>
352+ constexpr mgis::size_type disambiguateGetNumberOfComponents (
353+ const FunctionType&) //
354+ requires(!EvaluatorConcept<FunctionType>);
344355
345356 /* !
346357 * \brief number of components of a type when known at compile-time,
Original file line number Diff line number Diff line change @@ -17,7 +17,14 @@ namespace mgis::function::internals {
1717 constexpr decltype (auto ) disambiguateGetSpace(const FunctionType& f) //
1818 requires(!EvaluatorConcept<FunctionType>) {
1919 return getSpace (f);
20- }
20+ } // end of disambiguateGetSpace
21+
22+ template <FunctionConcept FunctionType>
23+ constexpr mgis::size_type disambiguateGetNumberOfComponents (
24+ const FunctionType& f) //
25+ requires(!EvaluatorConcept<FunctionType>) {
26+ return getNumberOfComponents (f);
27+ } // end of disambiguateGetNumberOfComponents
2128
2229} // end of namespace mgis::function::internals
2330
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ namespace mgis::function {
1515 template <FunctionConcept FunctionType, TensorConcept TensorType>
1616 constexpr bool TensorView<FunctionType, TensorType>::checkPreconditions(
1717 AbstractErrorHandler& eh, const FunctionType& values) {
18- const auto nc = values. getNumberOfComponents ( );
18+ const auto nc = internals::disambiguateGetNumberOfComponents (values );
1919 if (nc != compile_time_size<TensorType>) {
2020 return eh.registerErrorMessage (" invalid number of components" );
2121 }
You can’t perform that action at this time.
0 commit comments