Q

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)

==================================
MORE INFORMATION ON THIS TOPIC
==================================

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 first published in October 2002

Dig deeper on Web Development

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

SearchEnterpriseLinux

SearchDataCenter

Close