Boost logo

Boost :

From: Dr MaaTt (dr.maatt_at_[hidden])
Date: 2006-06-20 19:48:32


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);
or
b |= a;
without resorting to xxxUL etc?
at the moment I am doing
for( int i=0 ; i< 32 ; i++ ) if( (a & (1UL << i) ) ) b.set(i);

Thanks


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