Q

Can I pack Boolean arrays in C++?

I have the following attribute in my class:
bool a ;
bool b ;
bool c ;

All the attributes are Boolean arrays. I have to pack them to reduce space. Is it possible in C++? (I know it is possible in ADA.) If so, can you please let me know how I can achieve that?
In Visual C++ and Win32 development, these Boolean values will take up four bytes a piece. If you need to pack the data, you're much better off looking at a bit field representation.

This was first published in February 2003

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

SearchSOA

TheServerSide

SearchCloudApplications

Close