Jose Abilio Oliveira Matos <[EMAIL PROTECTED]> writes:
| On Thu, Mar 22, 2001 at 01:05:16PM +0100, Lars Gullik Bjønnes wrote:
| > Dekel Tsur <[EMAIL PROTECTED]> writes:
| >
| > | g++ -DHAVE_CONFIG_H -I. -I. -I. -I.. -I.. -I../boost -isystem
| > | /usr/X11R6/include -O -fno-rtti -fno-exceptions -W -Wall -c buffer.C
| > | buffer.C:21: bitset: No such file or directory
| > | make[2]: *** [buffer.o] Error 1
| >
| > And I don't see whay a bitset should be used...
| >
| > enum PAR_TAG {
| > NONE = 0
| > TT = 1,
| > SF = 2,
| > BF = 4,
| > IT = 8,
| > SL = 16,
| > EM = 32
| > };
|
| Notice that the code with bitsets is more clear than this version.
| Notice the following line:
| char const * tag_name[] = {"tt","sf","bf","it","sl","em"};
And I dislike this one too.
You can solve this one by a tostr<PAR_TAG> or a operator<<(ostream &,
PAR_TAG).
template<>
tostr(PAR_TAG const & pt)
{
switch (pt) {
case NONE: return string();
case TT: return "tt";
case SF: return "sf";
... etc;
}
btw. it seems that your tag_open should be changed to list<PAR_TAG>
tag_open.
| If I do it like that I need a map to relate the names to the numbers.
|
| That was the reason that lead me to use the bitset.
yes, but bitset is not aimed at solving this problem. It is for
working with bit representations. And by using it you get no type
checking on the enum type.
--
Lgb