From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-09-05 15:26:18


Jaakko Jarvi wrote:
> Hi,

Hi Jaakko,

>
> We're writing enable_if docs and have a question about MPL. The docs
> do not seem to mention metafunctions like not_ or and_;

Hmm, http://www.boost.org/libs/mpl/doc/ref/Reference/not.html?

> we can find
> logical_not, logical_and, etc. which seem to be applying to functions,
> not values.

'logical_not/_and/_or' were the old spellings; perhaps you are looking at
the old docs?

>
> So assuming we have:
>
> class A { static const bool value = true; };
>
> What is the right way to get the inverse of A::value as an MPL wrapped
> boolean?

Well, as everything else in the library that works with integral values,
'not_' expects its argument to be a model of a bool integral constant - that
is, 'A' should be

class A {
    static const bool value = true; // for convenience only
    typedef mpl::bool_<value> type;
};

Given that, yes, 'mpl::not_<A>' is the right way.

> PS. The reference manual was a bit hard to find, as the link was not
> in the table of contents of the main MPL documentation page.

Yes, it definitely needs fixing.

Thanks,
Aleksey