Skip to content
  • Mark OLESEN's avatar
    ENH: changed return value to bool for Ostream::write(const token&) · 5281dd48
    Mark OLESEN authored
    - the return value signals if this method handled this particular type
      of token. This minor change allows this method to be used as a succinct
      prefilter an output token stream. It also provides better encapsulation
      of what the particular output stream handles.
    
      Eg,
    
          bool ok = os.write(tok);
          if (!ok)   // or   if (!ok && os.good())
          {
              os << tok;
          }
    
      instead of
    
          if (tok.type() == typeA || tok.type() == typeB || ...)
          {
              os.write(tok);
          }
          else
          {
              os << tok;
          }
    5281dd48