ptree をプログラミングしていて、ある時点で DBL_MAX を (デフォルト値として) 入れる必要があります。生成された xml ファイルを開くと、正しい番号が表示されます。
しかし、ptree.get を使用して番号を取得すると、例外がスローされます。conversion of data to type "d" failed
これが私のコードです:
using boost::property_tree::ptree;
ptree pt;
double d=-DBL_MAX;
double d2=-1.797693134862316e+308;
double d3=-1.79769e+308;
cout<<d<<endl;
cout<<d2<<endl;
cout<<d3<<endl;
pt.put<double>("double", d);
write_xml("test.xml", pt);
cout << "totalEndTimeLowerBound: " << pt.get<double>("double")<<endl;
//doesn't work with d and d2, but works with d3
このエラーの原因と解決方法を教えてください。