#ifndef UPDATE_HPP
#define UPDATE_HPP
#include <cstdlib>
#include <utility>
namespace update_with_index_impl {
template<typename F, typename Variable>
void update(F&& f, std::size_t size, std::size_t index, Variable& var) {
f(size, index, var);
}
template<typename F, typename Variable, typename... Variables>
void update(F&& f, std::size_t size, std::size_t index,
Variable& var, Variables&... vars) {
f(size, index, var); update(std::move(f), size, index+1, vars...);
}
}
template<typename F, typename... Variables>
void update_with_index(F&& f, Variables&... vars) {
update_with_index_impl::update(std::move(f),
sizeof...(vars), 0, vars...);
}
#endif