xieite::value<>

Defined in header <xieite/meta/value.hpp>

A helper alias for std::integral_constant {}.


Definition

template<auto x>
using value = std::integral_constant<decltype(x), x>;


Example

template<auto...>
struct seq {};

template<auto n>
constexpr auto make_seq = ([]<auto... i>(this auto self, xieite::value<i>...) {
	if constexpr (sizeof...(i) < n) {
		return self(xieite::value<i>()..., xieite::value<static_cast<decltype(n)>(sizeof...(i))>());
	} else {
		return seq<i...>();
	}
})();

int main() {
	([]<int... i>(seq<i...>) {
		xieite::dump(i...);
	})(make_seq<5>);
}
Output:
0 1 2 3 4
[View in Compiler Explorer]