|
Boost : |
Subject: [boost] [interest] rich-typed smart pointers
From: Julian Gonggrijp (j.gonggrijp_at_[hidden])
Date: 2013-10-02 14:34:08
Dear Boost members,
I have designed a smart pointer that relies on the type system to
offer safe and flexible automatic memory management at no runtime
cost. It combines single ownership as in std::unique_ptr and reliable
access from multiple places as in std::shared_ptr with some additional
features. I believe it to be about as safe and practically useful as a
smart pointer in C++11 could get.
Further explanation and a proof-of-concept implementation is available
over here:
https://github.com/jgonggrijp/rich-typed-pointers
There is no license yet, but you have my explicit permission to try
the library and the example programs at your own risk. :-)
Could this library be useful addition to Boost? I look forward to your
comments.
Thanks in advance,
-Julian
PS: a possible minor seed for discussion is the current lack of an
implicit cast to bool. I agree with Jeff Flinn's argument why the
implicit cast may be desirable [1]. However, it interferes with the
comparison operators when one of the operands should be implicitly
cast to weak_ptr, as explained in [2]. I could repeat myself and write
comparison functions for all possible overloads, but this seems
inelegant.
[1] http://boost.2283326.n4.nabble.com/Looking-for-thoughts-on-a-new-smart-pointer-shared-ptr-nonnull-tp4652277p4652293.html
[2] https://github.com/jgonggrijp/rich-typed-pointers/commit/89fcf2821cb39bbb9fc1c4989701a500a59d1b48
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk