|
Boost : |
Subject: Re: [boost] [valid_ptr] proposing a new type of pointer object that allows validity tracking without memory management and object ownership
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2011-03-16 09:23:28
On 16/03/2011 13:57, Dan Walters wrote:
> Dear all,
>
> I am posting to propose a new light weight pointer object library
> (boost.valid_ptr) that provides safe validity checking without having
> to take ownership or the the responsibility of memory management of
> the object pointed to.
>
> The intention is to develop a useful pointer object that is easy to
> use and handles validity in a simple and invisible manner, to be used
> just like a normal pointer and in a way that a programmer would be
> familiar with, to produce cleaner and more intuitive code than other
> pointer libraries for its problem domain.
>
> The library would be best used when it is difficult to determine when
> an object will be released, for example, when pointing to objects
> higher on the stack, objects that are members of other objects or
> objects contained within a boost.ptr_container.
>
> The library is to be practically useful and most useful where
> boost.smart_ptr and boost.ptr_container libraries are not appropriate
> (for example, due to memory management or ownership not being
> required).
It seems very similar to what weak_ptr does, except it requires the
object to be allocated through valid_wrapper rather than with shared_ptr.
I like it because it's more lightweight though.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk