I can't understand rules guarantee for exception's safety.
In general, it's clear. But in details i'm lost in my resonings.
How can I determine which of the following functions (fun1 and fun2) provides a strict guarantee for exceptions? Which main steps in reasonings?
std::pair<std::unique_ptr<T>, std::unique_ptr<V>> fun1()
{
std::unique_ptr<T> pt(new T);
std::unique_ptr<V> pv(new V);
return std::make_pair(std::move(pt), std::move(pv));
}
void fun2(std::vector<std::string> & v, std::string const& s)
{
std::fill(v.begin(), v.end(), s);
}
Aucun commentaire:
Enregistrer un commentaire