[Ns-bugs] [Bug 1294] New methods in Buffer::Iterator

code@nsnam.ece.gatech.edu code at nsnam.ece.gatech.edu
Wed Mar 14 17:45:46 PDT 2012


https://www.nsnam.org/bugzilla/show_bug.cgi?id=1294

--- Comment #2 from Alex Afanasyev <alexander.afanasyev at ucla.edu> 2012-03-14 20:45:46 EDT ---
Here is the piece of code where I'm using Peek:

--- cut ---
  // parse the rest of nested blocks
  while (!start.IsEnd () && start.PeekU8 ()!=CCN_CLOSE)
    {
      Ptr<Block> block = Block::ParseBlock (start);
      m_nestedTags.push_back (block);
    }

  if (start.IsEnd ()) //should not be the end
      throw CcnbDecodingException ();

  start.ReadU8 (); // read CCN_CLOSE
--- end cut ---

I totally agree that Prev () call will give exactly the same functionality (I
kind of missed it existence when I was coding), but presence of PeekU8 ()
unifies Buffer.Iterator with standard streams (e.g., std::istream), which may
not have concept of putting things back.

-- 
Configure bugmail: https://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Ns-bugs mailing list