template <class T>
-void set_output_precision(T)
+void set_output_precision(T, std::ostream& os)
{
#ifdef BOOST_MSVC
#pragma warning(push)
#endif
if(std::numeric_limits<T>::digits10)
{
- std::cout << std::setprecision(std::numeric_limits<T>::digits10 + 2);
+ os << std::setprecision(std::numeric_limits<T>::digits10 + 2);
}
#ifdef BOOST_MSVC
#pragma warning(pop)
template <class Seq>
void print_row(const Seq& row, std::ostream& os = std::cout)
{
- set_output_precision(row[0]);
- for(unsigned i = 0; i < row.size(); ++i)
- {
- if(i)
- os << ", ";
- os << row[i];
+ try {
+ set_output_precision(row[0], os);
+ for (unsigned i = 0; i < row.size(); ++i)
+ {
+ if (i)
+ os << ", ";
+ os << row[i];
+ }
+ os << std::endl;
}
- os << std::endl;
+ catch (const std::exception&) {}
}
//
}
catch(const std::exception& e)
{
+ std::cerr << "Unexpected exception at entry: " << i << "\n";
std::cerr << e.what() << std::endl;
print_row(row, std::cerr);
BOOST_ERROR("Unexpected exception.");