Skip to content
Snippets Groups Projects
Commit 5281dd48 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: changed return value to bool for Ostream::write(const token&)

- 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;
      }
parent c51ee221
Branches
Tags
No related merge requests found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment