Problem solve Get help with specific problems with your technologies, process and projects.

Pack attributes to reduce space

I have the following attribute in my class

bool a [12];
bool b [100];
bool c [200];

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 please let me know how I can achieve that.

Looking at your example, it's not easy to imagine an alternative structure that would be more efficient and faster for processing than what you have.

If you had LARGE data sets that are sparsely populated, you could use a table with a 2 part key and a value. (Example: key = boola + index, value = 1 or 0)


Ask your Web development questions--or help out your peers by answering them--in our live discussion forums.

The Best Web Links: tips, tutorials and more.

Check out this live Q&A with Dave Slater and Jim Mason, How to best get started with WebSphere Development Tools.

This was last published in October 2002

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.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.