Boost logo

Boost :

From: Jaap Suter (J.Suter_at_[hidden])
Date: 2003-01-04 17:44:35


> > Is it possible that (under certain conditions) the following line:
> >
> > SNIP
> >
> > has a different type than this one:
> >
> > SNIP
>
> Uhm, in fact, these are always different:

Mm, I still don't quite understand. Consider the following function:

    void foo( int_c< 0 > );

Shouldn't the following code:

    foo( int_c< minus< int_c< 4 >, int_c< 4 > >::type > );

Behave the same as this:

    foo( minus< int_c< 4 >, int_c< 4 > >::type );

I thought that most of the time this does indeed seem to work this way.
However, in a few cases a get compiler errors (no matching type and that
kind of stuff), so I wrap the value of a complicated meta-calculation in a
new
int_c<> and that seems to fix it.

> or at the end ('bitand_'). I _think_ I prefer the latter.
> BTW, I think 'bit_shift_right' should be named simply 'shift_right'; after
> all, may be someone would like to "overload" it :).

I agree, and fixed it.

> Actually, I was planning on bringing the content of "arithmetic", "logic"
> and "comparison" directories to "boost/mpl" root (still preserving the
> corresponding composite headers). In that light, I would suggest putting
> the new headers directly into the root directory as well.

Yeah, that seems like a good idea because the folder-hierarchy doesn't match
the namespace-hierarchy. Are you able to do that soon?
I did it with the bit-meta-functions, and also added a shift_left.hpp and a
composite bit.hpp header.

I also added a bit.cpp in boost/libs/mpl/test directory that does a
unit-test. Let me know if you wish to see more extensive testing (with
different types).

>> Problem with bit_and
> So you can go this way, or just make everything take two operands
> only, and we'll take care of it later.

Yeah, the new bitand_ function only supports two operands now.

Everything is located in in the zip file on
http://jaap.flipcode.com/boost/bit.zip

Do you want me to put it in the sandbox instead? I still need to work on
my cvs skills, that's why I haven't put it there yet.

Thanks,

Jaap


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