title: C++ How to split stringstream using mulitple delimiters
body: <p>How would I go about splitting up a stringstream into individual strings using multiple delimiters?
  Right now it uses the default white space delimiter and I manually delete the first and last characters if they are anything other then alphanumeric.</p>
  
  <p>The goal here is to read in a .cpp file and parse it for all the user idents that are not reserved words in C++.</p>
  
  <p>It's working for benign examples but for stuff like this:</p>
  
  <pre><code>OrderedPair&lt;map_iterator, bool&gt; insert(const value_type&amp; kvpair)
  </code></pre>
  
  <p>It is not working.  I'd like to be able to split OrderedPair into it's own word, map_iterator into it's own, bool, insert, const, value_type, and kvpair all into individual words.</p>
  
  <p>How would I go about using "&lt; > , ( &amp; ) . -> *" as delimiters for my stringstream?</p>
  
  <pre><code> while (getline(inFile, line)) {
      isComment = false;
      stringstream sstream(line);
      while (sstream &gt;&gt; word) {
          isCharLiteral = false;
  
          if (!isComment) {
              if (word[0] == '/' &amp;&amp; word[1] == '/')
                  isComment = true;
          }
  
          if (!isMultilineComment) {
              if (word[0] == '/' &amp;&amp; word[1] == '*')
                  isMultilineComment = true;
          }
  
          if (!isStringLiteral) {
              if (word[0] == '"')
                  isStringLiteral = true;
          }
  
          if (!isCharLiteral) {
              if (word[0] == '\'' &amp;&amp; word.back() == '\'')
                  isCharLiteral = true;
          }
  
          if (isStringLiteral)
              if (word.back() == '"')
                  isStringLiteral = false;
  
          if (isMultilineComment)
              if (word[0] == '*' &amp;&amp; word[1] == '/')
                  isMultilineComment = false;
  
          if (!isStringLiteral &amp;&amp; !isMultilineComment &amp;&amp; !isComment &amp;&amp; !isCharLiteral) {
  </code></pre>