delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/16/14:31:47

Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
From: "A. Jans-Beken" <jabe AT oce DOT nl>
Subject: How to program a set of bits?
Message-ID: <34462916.7762@oce.nl>
Sender: news AT oce DOT nl (The Daily News @ nntp01.oce.nl)
Cc: jabe AT oce DOT nl
Organization: Océ-Nederland B.V.
Mime-Version: 1.0
Date: Thu, 16 Oct 1997 14:47:50 GMT
Lines: 21
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In a program i'am writing I have a class like this:

class PROPS {
   unsigned long set_of_32_bits;
   ...
   }

Now I want to have an operator '[]' so I can program:

PROPS flags;
flags[2] = FALSE;
flags[4] = flags[31] = TRUE;
flags[6] = flags[3];

Please note that this is not the famous BITVECT example that can be
found in many books about c++. I do not want to use a pointer to a bit
set because the pointer takes up 4 bytes extra and i'am planning to use
a huge array of PROPS (and related classes).

please respond via e-mail
thanx

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019