std::ios_base format flags are a resource that needs RAII

Suppose we wanted to write a class Fraction which would come equipped with an input operator>> that would accept input in the form -2/4 or 3/-8, but disallowing any spaces around the division bar. We would need the fraction class itself first, so, trying to stick to Test Driven Development rules, we would need to satisfy the following test function:
Read more of this post

Advertisements