
9 Mar
2005
9 Mar
'05
8:48 p.m.
Matthew Vogt wrote:
Rob Stewart wrote:
I guess it looks okay with c.value(). What do you think?
I don't like it.
That's the right approach: just code in terms of good(c). You get simplified code without the oddity of asking a basic_character for its character. The real value in the suggestion is that one should ignore fail() and eof() conditions in the filter. That's something you can document and your examples can show the simplified form.
But the 'simplified' form will have (c = get(src) && c.good()) everywhere, and the abstraction of algorithm state will result in more convoluted boolean expressions where testing 'good' will be very easy to omit...
The idiom would be: if (good(c = get(src))) { ... } Jonathan