asdas

asda
mail@pastecode.io avatar
unknown
c_cpp
3 years ago
394 B
3
Indexable
Never


struct DoOrWaitVisitor {
   Response operator()(const std::promise<Response>& response) {
       Response r = DoWholeWork(arg_);
       response.set_value(r);
       return r;
   }
   
   Response operator()(const std::future<Response>& response) {
       return response.get();
   }
   
   const SomeArg& arg_;
};



int main() {
    std::visit(DoOrWaitVisitor{"some argument"}, response);
}