vendredi 1 juin 2018

Conversion from std::future

The method validate(std::string& request, int& id) returns bool.

When I use this syntax the compilation finishes:

auto task_1 = std::async([&]{ validate(request, id); });

However, when I use std::future the compilation fails :

std::future<bool> task_1 = std::async([&]{ Internal::validate(request, id); });

The error is:

error: conversion from ‘std::future’ to non-scalar type ‘std::future’ requested

What is wrong here? I want to check that

task_1.get() == true

Aucun commentaire:

Enregistrer un commentaire