On Thu, Apr 4, 2013 at 6:01 PM, Michael Powell <mwpowellhtx@gmail.com> wrote:

I realize now what I was (or wasn't) doing. The ctor can handle *number of bits* followed by a default value, first of which was key. I was telling it default value (usually ZERO) which ended up causing all kinds of havoc during the setters.
 
On Thu, Apr 4, 2013 at 8:32 AM, Michael Powell <mwpowellhtx@gmail.com> wrote:

Another question, perhaps to clarify my misunderstanding how dynamic_bitset operates:

On line 109 of dynamic_bitset.hpp, it would appear that it's dealing with m_block as a reference. In other words, dynamic_bitset is a view on an existing variable. Which is fine, that's perfect actually. That gets me closer to where I'd like to be and means I don't have to chase vectors of bytes for the result.

Does that mean we use it something like this:

unsigned char my_data;
boost::dynamic_bitset<unsigned char> my_bitset(my_data);
//Twiddle some bits...
//Run with the my_data answer...

Is that accurate or am I still misunderstanding? Thank you...

 
On Thu, Apr 4, 2013 at 8:22 AM, Michael Powell <mwpowellhtx@gmail.com> 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).

'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