void set_result_helper(future<void> f, T& val, F fun) { fun(val); f.consume(); }
void set_result_helper(future<NT> f, T& val, F fun) { f.consume(fun(val)); }