A new component with STLSoft 1.10 (alpha 11 onwards) is the stlsoft::integer_to_array() function template. It is used to turn a single integer value into an array of bit-chunk values.
For example, given the integer i with value 0x01020304, we can split this into the 8 nibbles as follows:
stlsoft::integer_array r = stlsoft::integer_to_array(i, 4);
r will be 4, r will be 0, r will be 3, r will be 0, r will be 2, r will be 0, r will be 1, and r will be 0.
The split can be on any value between 0 and the bitsize of the input parameter (which can be any of the integral types); so you can split on 3 bits, 1 bit, 17 bits, whatever.
I've done extensive automated tests, and they all pass (natch), but I'm still a little dubious about the component, so I'm definitely interested in feedback.
In case you're wondering, the original rationale for this was a simple way to go from the s_addr member of struct in_addr, which is held in network byte order but is otherwise "opaque".