Boost logo

Boost :

Subject: Re: [boost] [assign] operators+= and -= for set/reset bits in std::bitset
From: Jeffrey Lee Hellrung, Jr. (jhellrung_at_[hidden])
Date: 2010-12-07 10:40:24


On 12/07/2010 01:24 AM, Robert Jones wrote:
> On Tue, Dec 7, 2010 at 9:11 AM, Winkler, Bernd<
> Bernd.Winkler_at_[hidden]> wrote:
>
>> Bitset<8> flag_pattern; //initialisation to "00000000"
>> flag_pattern += 1,3,4,5; //set bits at indices 1,3,4,5 to true: 01011100
>
> Doesn't the interpretation of that depend on the endianness of your
> architechture?
> I would have expected

AFAIK, there's nothing architecture-dependent about the semantics of
std::bitset (that's what we're talking about, right?) operations.

I would usually consider "set bit at indices 1,3,4,5 to true" to yield
"00111010", but it depends which direction you like to write your bitset
bits...

- Jeff


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