We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3535564 commit 125dea6Copy full SHA for 125dea6
include/svs/lib/misc.h
@@ -443,4 +443,20 @@ template <std::integral T> constexpr T bitmask(T lo, T hi) {
443
444
using DefaultPredicate = std::function<bool()>;
445
446
+///
447
+/// Returns true if at least one element of the span is NaN.
448
449
+template <typename T, size_t N>
450
+bool contains_nan(std::span<const T, N> data) {
451
+ return std::any_of(data.begin(), data.end(), [](T v) { return std::isnan(v); });
452
+}
453
+
454
455
+/// Returns true if all elements of the span are NaN.
456
457
458
+bool all_nan(std::span<const T, N> data) {
459
+ return std::all_of(data.begin(), data.end(), [](T v) { return std::isnan(v); });
460
461
462
} // namespace svs::lib
0 commit comments