@@ -276,24 +276,34 @@ namespace xtd {
276276 // / @brief Computes the average of a sequence of optional xtd::decimal values.
277277 // / @param source A sequence of optional xtd::decimal values to calculate the average of.
278278 // / @return The average of the sequence of values, or xtd::nullopt if the source sequence is empty or contains only values that are xtd::nullopt.
279- [[nodiscard]] static auto average (const ienumerable<xtd::optional<xtd::decimal >>& source) noexcept -> xtd::optional<xtd::decimal>;
279+ template <xtd::forward_iterable source_t >
280+ requires std::same_as<typename xtd::raw_type<source_t >::value_type, xtd::optional<xtd::decimal>>
281+ [[nodiscard]] static auto average (source_t && source) -> xtd::optional<xtd::decimal>;
280282 // / @brief Computes the average of a sequence of optional double values.
281283 // / @param source A sequence of optional double values to calculate the average of.
282284 // / @return The average of the sequence of values, or xtd::nullopt if the source sequence is empty or contains only values that are xtd::nullopt.
283- [[nodiscard]] static auto average (const ienumerable<xtd::optional<double >>& source) noexcept -> xtd::optional<double>;
285+ template <xtd::forward_iterable source_t >
286+ requires std::same_as<typename xtd::raw_type<source_t >::value_type, xtd::optional<double >>
287+ [[nodiscard]] static auto average (source_t && source) -> xtd::optional<double>;
284288 // / @brief Computes the average of a sequence of optional float values.
285289 // / @param source A sequence of optional float values to calculate the average of.
286290 // / @return The average of the sequence of values, or xtd::nullopt if the source sequence is empty or contains only values that are xtd::nullopt.
287- [[nodiscard]] static auto average (const ienumerable<xtd::optional<float >>& source) noexcept -> xtd::optional<float>;
291+ template <xtd::forward_iterable source_t >
292+ requires std::same_as<typename xtd::raw_type<source_t >::value_type, xtd::optional<xtd::single>>
293+ [[nodiscard]] static auto average (source_t && source) -> xtd::optional<xtd::single>;
288294 // / @brief Computes the average of a sequence of optional xtd::int32 values.
289295 // / @param source A sequence of optional xtd::int32 values to calculate the average of.
290296 // / @return The average of the sequence of values, or xtd::nullopt if the source sequence is empty or contains only values that are xtd::nullopt.
291- [[nodiscard]] static auto average (const ienumerable<xtd::optional<xtd::int32 >>& source) noexcept -> xtd::optional<double>;
297+ template <xtd::forward_iterable source_t >
298+ requires std::same_as<typename xtd::raw_type<source_t >::value_type, xtd::optional<xtd::int32>>
299+ [[nodiscard]] static auto average (source_t && source) -> xtd::optional<double>;
292300 // / @brief Computes the average of a sequence of optional xtd::int64 values.
293301 // / @param source A sequence of optional xtd::int64 values to calculate the average of.
294302 // / @return The average of the sequence of values, or xtd::nullopt if the source sequence is empty or contains only values that are xtd::nullopt.
295- [[nodiscard]] static auto average (const ienumerable<xtd::optional<xtd::int64 >>& source) noexcept -> xtd::optional<double>;
296-
303+ template <xtd::forward_iterable source_t >
304+ requires std::same_as<typename xtd::raw_type<source_t >::value_type, xtd::optional<xtd::int64>>
305+ [[nodiscard]] static auto average (source_t && source) -> xtd::optional<double>;
306+
297307 // / @brief Casts the elements of an xtd::collections::generic::ienumerable to the specified type.
298308 // / @tparam result_t The type of the resulting value.
299309 // / @tparam source_t The type of the elements of source.
0 commit comments