sözlüğünün copy_exception
numaralı başvuruda nasıl kullanıldığına dair çeşitli yerlerde bulundu, ancak geçerli FDIS'de bulamıyorum. Bu bloglardan beri set_exception()
'un nasıl kullanıldığına dair alternatif bir yol var mı? Örneğin herePromise :: set_exception (x) için argüman nasıl alınır?
void asyncFun(promise<int> intPromise)
{
int result;
try {
// calculate the result
intPromise.set_value(result);
} catch (MyException e) {
intPromise.set_exception(std::copy_exception(e)); // <- copy
}
}
için
Ben std::current_exception()
here bulabilirsiniz. Bu nedenle
catch(...)
{
p.set_exception(std::current_exception());
}
sorularım: Ben "...
" yakalamak yokken bile
- Hep,
current_exception()
kullanmalı mıyım? - Yoksa
copy_exception
için yeni bir ad var mı?