For example (just example, but illustrates situation I have):
void binary_tree::unite(const iface& tree)
{
node_impl = new binary_tree_node(node_impl, std::auto_ptr<impl>(tree->clone()));
}
In the example above I need to be sure that after iface::clone() execution,
\the pointer returned will be acquired by std::auto_ptr (or std::unique_ptr
or any other lightweight smart pointer) before calling allocation function,
which can throw exception.
For now, I store std::auto_ptr in separate local variable:
std::auto_ptr<impl> right_subtree(tree->clone());
node_impl = new binary_tree_node(node_impl, right_subtree);
But using such constructions won't allow compiler to apply copy elision of
second argument of binary_tree_node c'tor.