
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 mbiddeg@mtn.co.ug skrev:
From an exception safety POV: What happens if db.commit(txn) is never called here? The raw Transaction pointer raises my hackles immediately.
Why not just use:
std::unique_ptr<Transaction> txn(db.beginTransaction()); { ... } db.commit(*txn); //db.commit(txn.get());//
That'd be a start, but I don't think it should be the user's job to do that "security". Factory functions that return raw pointers are too easy to misuse. The object db could return an auto_ptr (or unique_ptr, or...) instead of a raw pointer, and we'd immediately be better off. /Brian -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktQDrgACgkQk1tAOprY6QGh3QCg3lhEA6K6MiBxgOqRW2/QJJJl 4OQAoLI2LBsdznGVif4Ehohm/0P5+Xce =yaeC -----END PGP SIGNATURE-----