Boost logo

Boost Users :

From: Lang Stefan (SLang_at_[hidden])
Date: 2008-04-23 03:55:10


> On Tue, Apr 22, 2008 at 10:43 AM, Lang Stefan
> <SLang_at_[hidden]> wrote:
> > I have a big problem though: The project I am working on
> is quite big
> > and I intend to replace a particular typedef (currently
> simply a pointer
> > to a struct) with this iterator class. There are two kinds of
> > instructions though that my iterator class currently can't
> cope with:
> >
> > 1. Initializing a 'pointer' with NULL (in other words, I need a
> > constructor with one argument of type int, but only in case that
> > argument's value is 0)
> >
>
> How about some really weird pointer type? If you did a member
> function type that doesn't actually exist, you should be able to
> construct with NULL, but nothing else.
>

Whatever you have in mind, I have no idea what you mean. Could you
elaborate please?

Btw., I did consider somehow introducing one of the boost smart pointer
types to resolve this issue, but apparently even the smart pointers
cannot directly deal with NULL values (e.g. comparison to NULL requires
calling the get() method first).

I could of course introduce special functions for semantically equal
purposes, but that would force me to change several thousand lines of
code to match the new syntax. I can think of better ways to waste my
time...

Is it possible to construct metafunctions that allow a function argument
of NULL, but not any other integer value? Or at least cause the compiler
to call out whenever a non-NULL argument is provided?

Cheers,
Stefan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net