|
Boost Users : |
From: Lang Stefan (SLang_at_[hidden])
Date: 2008-04-24 04:06:11
> >
> > 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
>
> struct convertible_from_null {
> struct null_pointer_impl_t;
> typedef null_pointer_impl_t
> (convertible_from_null::*null_pointer_t)();
> convertible_from_null(null_pointer_t* = 0) {}
> };
>
> convertible_from_null test = 0;
>
> //convertible_from_null fail = 1;
>
> int main() {}
>
> In Christ,
> Steven Watanabe
>
Thanks a lot, this did it! I also managed to adapt this construct to
provide comparison operators for comparisons with NULL values, so all my
issues have been resolved. :)
So now, apart from direct pointer assignments and delete statements
(which I know need to be fixed anyway) my array iterator mostly behaves
like a pointer. Fortunately, thanks to Steven's suggestion, the compiler
does now show up all the problematic statements.
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