Boost logo

Boost :

From: Philippe A. Bouchard (philippeb_at_[hidden])
Date: 2003-02-25 08:35:46


Philippe A. Bouchard wrote:

[...]

> It's true. Imagine we have some partial specialization of array<bool,
> size_t>:
>
> template <unsigned int I>
> struct array<bool, I>
> {
> char value_[I >> 3];
>
> // Read-only version:
> bool operator [] (unsigned int a_index) const
> {
> return value_[a_index >> 3] & (1u << (a_index % 8));
> }
> };

Please excuse me for writing to way, I am taking for granted a char is 8
bits long. I do not wish to bypass any portability rules...

Philippe A. Bouchard


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