using namespace std;
-namespace lyx {
+namespace {
+
+// A version of lexical cast that does not throw. Useful for when we convert to string
+template<typename To, typename From>
+To lexical_cast(From const & value, To const & defaultResult = To())
+{
+ try {
+ return boost::lexical_cast<To>(value);
+ } catch(...) {
+ // Ignore all exceptions and use default.
+ return defaultResult;
+ }
+}
-using boost::lexical_cast;
+} // namespace
+
+
+namespace lyx {
template<>
string convert<string>(bool b)
}
-#ifdef LYX_USE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
template<>
string convert<string>(unsigned long long ull)
{
}
-#ifdef LYX_USE_LONG_LONG
+#ifdef HAVE_LONG_LONG_INT
template<>
string convert<string>(long long ll)
{