trace - string:const_iterator end = optflags.end for itor!=...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream> #include <limits> #include <vector> using namespace std; #include "trace.h" // // ** BUG IN STL ** BUG IN STL ** // We should use vector<bool> instead of vector<char>, // but vector<bool> has a bug: // http://forums.sun.com/thread.jspa?threadID=5277939 // Static linking works, but doubles the size of the executable // image. // ** BUG IN STL ** BUG IN STL ** // typedef vector<char> boolvec; boolvec traceflags::flags (UCHAR_MAX + 1, false); const boolvec trueflags (UCHAR_MAX + 1, true); string::const_iterator itor = optflags.begin();
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: string::const_iterator end = optflags.end(); for (; itor != end; ++itor) { if (*itor == '@') { flags = trueflags; }else { flags[*itor] = true; } } // Note that TRACE can trace setflags. TRACE ('t', "optflags = " << optflags); } // // getflag -// Check to see if a certain flag is on. // bool traceflags::getflag (char flag) { // Bug alert: // Don't TRACE this function or the stack will blow up. bool result = flags[flag]; return result; } RCSC(trace_cc, "$Id: trace.cc,v 1.70 2009-01-02 19:10:43-08 - - $")...
View Full Document

Ask a homework question - tutors are online