Re: vector and bool
From: Richard Herring (junk_at_[127.0.0.1)
Date: 10/12/04
- Next message: JKop: "Re: How to do that"
- Previous message: Phlip: "Re: How to do that"
- In reply to: Ioannis Vranos: "Re: vector and bool"
- Next in thread: Ioannis Vranos: "Re: vector and bool"
- Reply: Ioannis Vranos: "Re: vector and bool"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 12 Oct 2004 18:12:33 +0100
In message <1097598729.868638@athnrd02>, Ioannis Vranos
<ivr@guesswh.at.grad.com> writes
>Richard Herring wrote:
>
>>> reference is a class that simulates the behavior of references of a
>>>single bit in vector<bool>."
>>
>> That just redefines the semantics of operator[] etc. to return a
>>proxy instead of an actual bool &, thus removing the requirement for
>>elements to have distinct addresses. Nothing there says that it _must_
>>use only use one bit per element.
>
>Well since it says that
>
>"reference is a class that simulates the behavior of references of a
>single bit in vector<bool>"
>
>I think this implies that vector<bool> should be implemented using bits.
>
For a weak enough meaning of "should", I agree that that's the
intention. But I don't think anything in the Standard rules out a naive
implementation that makes no attempt to optimise, and simply implements
vector<bool> in terms of an underlying vector<some_int_type>.
-- Richard Herring
- Next message: JKop: "Re: How to do that"
- Previous message: Phlip: "Re: How to do that"
- In reply to: Ioannis Vranos: "Re: vector and bool"
- Next in thread: Ioannis Vranos: "Re: vector and bool"
- Reply: Ioannis Vranos: "Re: vector and bool"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|