Boost logo

Boost Users :

Subject: Re: [Boost-users] dynamic_bitset get block_type not ulong
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-04-04 09:32:29


On Thu, Apr 4, 2013 at 8:22 AM, Michael Powell <mwpowellhtx_at_[hidden]>wrote:

> Hello,
>
> How do I get at the block_type value itself, not an unsigned long, from a
> dynamic_bitset (or std::bitset for that matter).
>

The best candidate I've found thus far is:
http://stackoverflow.com/questions/8297913/how-do-i-convert-bitset-to-array-of-bytes-uint8

'Course, then there's the argument, is that too much abstraction around
what is basically a "simple" bit-field bit-mask I want to accomplish.

> For instance, can I do something like this?
>
> typedef unsigned char byte;
> boost::dynamic_bitset<byte> my_bitset(static_cast<byte>(0x00));
> //Do some bit twiddling...
> byte my_value = static_cast<byte>(my_bitset);
>
> Or something like that. Basically I want to avoid any to_ulong() mumbo
> jumbo if I can just get at the underlying block_type value.
>
> Thank you...
>
> Regards,
>
> Michael Powell
>



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