%\bigskip
%\noindent \textbf{String}, \texttt{\#include $<$string$>$}
\subsection*{String, \texttt{\#include $<$string$>$}}

Iterators are invalidated by inserts/deletes


  \begin{tabular}{llll}
    \texttt{   } & \texttt{push\_back (c)}    & \texttt{c* } & \texttt{c\_str ()} \\
    \texttt{b  } & \texttt{empty ()}          & \texttt{i  } &  \texttt{size ()} \\
    \texttt{c\&} & \texttt{back ()}           & \texttt{c\&} & \texttt{front ()}  \\
    \texttt{   } & \texttt{clear ()}          & \texttt{   } &  \texttt{resize (i)} \\
    \texttt{c  } & \texttt{operator[i]}       & \texttt{   } & {} \\
    \texttt{i  } & \texttt{find (string, pos)}  & \texttt{i  } & \texttt{find (c, pos)}
  \end{tabular}

 \smallskip

  \begin{tabular}{ll}
    \texttt{erase([pos], [n])}   & \texttt{append(n, c)} \\
    \texttt{substr(pos, [n])}    & \texttt{insert(pos, s)} \\
    \texttt{insert(pos, c)}      & \texttt{insert(pos, n, c)} \\
    \texttt{find\_first\_of(s)}    & \texttt{find\_first\_not\_of(s)}
  \end{tabular}

\smallskip
\texttt{find} returns \texttt{string::npos} if the given string or character
can't be found.

%\noindent \textbf{Char Predicates}, \texttt{\#include $<$cctype$>$}
\subsection*{Char Predicates, \texttt{\#include $<$cctype$>$}}

  \begin{tabular}{rl}
    \texttt{isalnum}     & alpha or digit \\
    \texttt{islower}     & \texttt{isupper} \\
    \texttt{alpha}     & letter (upper or lower) \\
    \texttt{digit}     & 0 to 9 \\
    \texttt{space}     & any whitespace \\
    \texttt{graph}     & alnum or punct  \\
    \texttt{print}     & not cntrl = graph or ' ' \\
    \texttt{punct}     & print \& !(space or alnum) \\
    \texttt{xdigit}    & hex digit
  \end{tabular}

  \smallskip

\lstset{language=C++}
%012345678901234567890123456789012345678901234
\begin{lstlisting}
string lowercase(string s) {
  string rv(s); // could be in-place
  for(int i = 0; i < s.size(); ++i)
      rv[i] = tolower(s[i]);
  return rv;}
\end{lstlisting}

\begin{lstlisting}
template<class N>
string to_str(N n) { stringstream s;
                   s << n; return s.str(); }
double to_num(string s) { stringstream ss(s);
              double n; ss >> n; return n; }
\end{lstlisting}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "ref-doc"
%%% End:
