Having trouble with std::async
, every way I write it turns out to be illegal. Anyone got any suggestions?
PS: It's an async IP range scanner.
bool PortCheck(std::string ip, int port)
{
}
std::vector<std::pair<std::string, std::future<bool>>> JobPool;
std::future<bool > f = PortCheck(argStartAddress, argPort);
JobPool.push_back(std::make_pair(
argStartAddress,
f
));
std::future<bool> f = std::async(PortCheck, argStartAddress, argPort);
JobPool.push_back(std::make_pair(
argStartAddress,
std::move(f) // note std::move
));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.