• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: BOOL array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: BOOL array (From: "Alex Reynolds" <email@hidden>)

  • Prev by Date: Re: BOOL array
  • Next by Date: Core Data and ordered relationships
  • Previous by thread: Re: BOOL array
  • Next by thread: Re: BOOL array
  • Index(es):
    • Date
    • Thread