Boost logo

Boost :

Subject: Re: [boost] [valid_ptr] proposing a new type of pointer object that allows validity tracking without memory management and object ownership
From: Gruenke, Matt (mgruenke_at_[hidden])
Date: 2011-03-16 19:14:40


"Non-NULL" is different than "valid". Maybe such a thing should be called nonnull_ptr<>? In the case of passive_ptr<>, I do allow it to be NULL. While a nonnull_ptr<> would useful, it would only cover some of the cases in which I use passive_ptr<>.

I don't see why you'd have to check for NULL upon copy or assignment from another nonnull_ptr<>. It only needs to check in the constructor and when the value is directly changed. In fact, aside from that runtime check and the ability to alter the value, I don't really see what it buys you over using a reference. Also, whether the value is NULL is orthogonal to ownership - I could imagine having a nonnull_shared_ptr<>, nonnull_scoped_ptr<>, etc.

Matt

-----Original Message-----
From: Klaim - Joël Lamotte [mailto:mjklaim_at_[hidden]]
Sent: Wed 3/16/2011 6:37 PM
To: boost_at_[hidden]
Cc: Gruenke, Matt
Subject: Re: [boost] [valid_ptr] proposing a new type of pointer object that allows validity tracking without memory management and object ownership
 
As far as I understand, it's only a type working like a raw pointer but with
checks on assignation and copy. Those checks will only assume that the
pointer don't have a NULL value, (or maybe points to an adress that i'snt
possible?)

is it correct understanding of this library?

Joël Lamotte.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk