Re: BOOL array
Re: BOOL array
- Subject: Re: BOOL array
- From: Ken Thomases <email@hidden>
- Date: Mon, 15 Sep 2008 16:53:42 -0500
On Sep 15, 2008, at 4:43 PM, Alex Reynolds wrote:
Is there a difference in the underlying storage between vector<BOOL>
and
vector<bool>?
Yes! std::vector is a class template. There's a generic
implementation provided that works with any type (within certain
constraints), but there's a specialization for the 'bool' case. You
only get ~1 bit for bit with the specialization, i.e. vector<bool>.
Given that BOOL is typedef'ed to signed char, vector<BOOL> uses the
same storage as vector<signed char>, about 1 byte per element.
Cheers,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden