8 Oct
2013
8 Oct
'13
2:26 p.m.
On 08-10-2013 14:00, Thorsten Ottosen wrote:
The shared_ptr implementation would have to check its template argument and emit special code in a few places. This is very easy to do, and far easier than specializing/wrapping the class.
Another benefit of this approach is that we can create different behaviors without relying on the absurd subtleties of the preprocessor: typedef boost::shared_ptr<T> SharedT; // normal shared_ptr typedef boost::shared_ptr<assert_non_null<T>> NonNullSharedT; // no null enforced by assertions typedef boost::shared_ptr<enforce_non_null<T>> NeverNullSharedT; // no null enfoced by exceptions regards -Thorsten