I am a bit uncertain about how to achieve variadic-expansion in compile time. Consider the below use-case where I'd like to figure out the index of the max-element in the sequence:
template<A>
struct doSomething {
static constexpr int getIndexOfMaxValue() {
// recursive variadic expansion
}
static constexpr int value = getIndexOfMaxValue();
}
int main() {
std::cout << doSomething<std::integer_sequence<int, 1, 2, 3, 4, 3>::value <<std::endl;
}
Can someone kindly help me explain this?
Aucun commentaire:
Enregistrer un commentaire