Opened 13 years ago
Closed 13 years ago
#3610 closed Bugs (fixed)
boost::format copy constructor can create format object in unexpected state.
Reported by: | Owned by: | Samuel Krempp | |
---|---|---|---|
Milestone: | Boost 1.41.0 | Component: | format |
Version: | Boost 1.37.0 | Severity: | Problem |
Keywords: | Cc: |
Description
If I copy construct a new boost::format object, I expect it to be in a (re)useable state. However, the following code throws a boost::io::too_many_args exception
{
boost::format f("%d");
std::cout << f % 10 << std::endl; std::cout << f % 10 << std::endl; format object can be reused
boost::format f2(f); std::cout << f2 % 10 << std::endl; exception raised - new format is not in a valid state for formatting
}
On inspection of the code, the copy constructor always sets the dumped_ member to false, yet it copies the cur_arg_ from the rhs object. It's hard to see how this behaviour might be desirable.
Agreed, that was an oversight, the copy-constructed should copy .dumped_ fixed in revision 57672