Boost logo

Boost :

From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2006-06-22 04:09:42


On Tue, 20 Jun 2006 16:48:32 -0700, "Dr MaaTt" <dr.maatt_at_[hidden]>
wrote:

>is there a way to turn a regular (unsigned long) integer into bitset? for
>example,
>unsigned long int a=1234567890;
>boost::dynamic_bitset<> b(32);
>
>can I do something similar to
>boost::dynamic_bitset<> b(32, a);

Yes, there's a constructor for that:

<http://www.boost.org/libs/dynamic_bitset/dynamic_bitset.html#constructors>

For portability, you might want to use numeric_limits<> to find out
the width in bits of unsigned long.

--Gennaro.


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