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.
amount
1 parent 6715802 commit 005a9e6Copy full SHA for 005a9e6
amount.hpp
@@ -1,5 +1,8 @@
1
#pragma once
2
3
+#include<utility> // std::index_sequence
4
+#include<cstddef> // std::size_t
5
+
6
namespace mlib
7
{
8
template<auto T>
@@ -14,11 +17,10 @@ namespace mlib
14
17
15
18
constexpr auto amount<T>::times(auto&& lambda) const
16
19
- lambda();
- if constexpr (T - 1 != 0)
20
+ [] <std::size_t... indexes>(std::index_sequence<indexes...>)
21
- amount_t<T - 1>.times(lambda);
- }
22
+ (lambda(), void(indexes), ...);
23
+ }(std::make_index_sequence<T>{});
24
return true;
25
}
26
}; // namespace mlib
0 commit comments