Tony Rick wrote: > On Mon, Feb 15, 2010 at 10:11 AM, Tim Wescott <t...@wescottdesign.com> wrote: > > >> You are extracting individual characters out of rawInput by getting a >> pointer to a character array, then getting characters 'the C way'. >> >> Yet the string class has a character extraction operator -- why not just >> use rawInput[i], or rawInput.at(i)? >> >> > > ...or iterator members rawInput.begin() and rawInput.end() to avoid using > size() at all? > modified example from the string RefMan entry: > string::iterator it; > for (it = rawInput.begin(); it < rawInput.end(); it++) { > if (*it == 0x2e) { > etc, etc, etc > } > > - tony > Indeed, I should have mentioned it. I _thought_ it, but then I thought it'd be hard to explain, so I didn't pursue it.
That's probably how I'd carry out the task, if I couldn't use the higher-level parsing functions available from string (like find, substr, etc.). I'd have to think about it to know if they could be used to advantage -- I do nearly all my C++ work in small embedded systems where use of the STL is anathema. -- Tim Wescott Wescott Design Services Voice: 503-631-7815 Cell: 503-349-8432 http://www.wescottdesign.com _______________________________________________ PLUG mailing list PLUG@lists.pdxlinux.org http://lists.pdxlinux.org/mailman/listinfo/plug