The methods in this class use an index sequence containing a sequence of indices covering the entire data tuple (an index for each argument passed in the parameter pack). Per other answers I've seen, I'm currently templating my methods as such:
#include <tuple>
#include <memory>
#include <vector>
using std::tuple;
template <typename... Args>
class Foo
{
protected:
tuple<std::shared_ptr<std::vector<Args>>...> data;
private:
template<size_t...Is>
void _clear_(std::index_sequence<Is...>) {
(std::get<Is>(data)->clear(), ...);
};
public:
void clear()
{ _clear_(std::index_sequence_for<Args...>()); };
};
This seems messy, though. I was wondering if there's a way that I could define Is at a class-level scope (or, more generally, whether there's a better way to do this).