Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
char input[] = "bogus@addr.com; cat /etc/passwd";
string::iterator loc;
string email;

// copy into string converting ";" to " "
for (size_t i=0; i <= strlen(input); i++) {
  if (input[i] != ';') {
    loc = email.insert(loc, input[i]);
  }
  else {
    loc = email.insert(loc, ' ');
  }
  ++loc;
} // end string for each element in NTBS	

Non-Compliant Example

Code Block

...

The intent of these iterator invalidation rules is to give implementors greater freedom in implementation techniques. Some implementations implement method version that do not invalidate references, pointers, and iterators in all cases. Check with your implementation specific documentation and document any violation of the semantics specified by the standard for portability.

References