|
Boost : |
Subject: Re: [boost] Boost library submission (poll for interest)
From: Brian Ravnsgaard Riis (brian_at_[hidden])
Date: 2010-01-15 01:44:08
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
mbiddeg_at_[hidden] 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-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk