15 #define QX_CONSTEXPR_SEQUENCE_SUPPORTED !QX_MSVC
17 #if QX_CONSTEXPR_SEQUENCE_SUPPORTED
41 template<
class tag_t,
class T, T Start, T Func(T)>
45 template<
size_t nIndex>
48 static constexpr T
value() noexcept
52 for (
size_t i = 0; i < nIndex; ++i)
53 _value = Func(_value);
59 template<
size_t nIndex>
62 template<
size_t nCurrent,
bool bWasSet >
65 static constexpr
size_t index() noexcept
71 template<
size_t nCurrent>
72 struct checker_wrapper
76 size_t nNext = checker_setter<nCurrent, bWasSet> {}.index()>
77 static constexpr
size_t index() noexcept
83 template<
size_t nCurrent>
84 struct checker_setter<nCurrent, true>
86 template<
size_t nNext = checker_wrapper<nCurrent + 1> {}.index()>
87 static constexpr
size_t index() noexcept
104 template<
size_t nIndex = checker_wrapper<0> {}.index(), T _value = element<nIndex> {}.value()>
122 size_t nIndex = checker_wrapper<0> {}.index(),
123 T _value = element<nIndex> {}.value(),
124 bool bStub = element_flag<nIndex> {}.test_and_set()>
125 static constexpr T
next() noexcept
134 template<
class T, T Term>
135 constexpr T increase(T val)
140 template<
class T, T Multiplier>
141 constexpr T multiply(T val)
143 return val * Multiplier;
148 template<
class tag_t = struct counter_tag,
class T =
int, T Start = 0, T Term = 1>
149 using constexpr_counter = constexpr_sequence<tag_t, T, Start, details::increase<T, Term>>;
151 template<
class tag_t = struct multiplier_tag,
class T =
int, T Start = 1, T Multiplier = 2>
152 using constexpr_multiplier = constexpr_sequence<tag_t, T, Start, details::multiply<T, Multiplier>>;
Constexpr sequence. use unique tag for different instances.
static constexpr T value() noexcept
Get current sequence value.
static constexpr T next() noexcept
Change value by Func and return new value �details As function works through generating new template ...