box2d operator<< - output "box2d(INVALID)" for invalid box.

This commit is contained in:
artemp 2016-03-07 13:51:50 +01:00
parent a8b8f2e001
commit cdeb806371

View file

@ -372,9 +372,16 @@ template <typename T>
std::string box2d<T>::to_string() const
{
std::ostringstream s;
s << "box2d(" << std::fixed << std::setprecision(16)
<< minx_ << ',' << miny_ << ','
<< maxx_ << ',' << maxy_ << ')';
if (valid())
{
s << "box2d(" << std::fixed << std::setprecision(16)
<< minx_ << ',' << miny_ << ','
<< maxx_ << ',' << maxy_ << ')';
}
else
{
s << "box2d(INVALID)";
}
return s.str();
}