how to convert long double to string format in Xco

2019-08-31 12:06发布

this code works in microsoft visual c++, but when i run this in Xcode, it give me error No member named 'to_string' in namespace 'std'

double learningRates[] = {0.00015, 0.00065, 0.00075, 0.0015, 0.0045, 0.0065, 0.0075, 0.055};

long double learning_Value = learningRates[learningRate_Index];

string pathtotal_weight_Bias= pathWeightBias +"/" + "best_weight_Bias" + convertInt(MaxEpochs) +"_LR"+ to_string(learning_Value)+".xml";

even if i used std::to_string(learning_Value), even than it gives the same error.

Kindly guide me in this regards. thanks

1条回答
女痞
2楼-- · 2019-08-31 13:03

I think stringWithFormat might do the trick:

        NSString *string = [NSString stringWithFormat:@"%d/best_weight_Bias%d_LR%Lf.xml", pathWeightBias, MaxEpochs, learning_Value];
查看更多
登录 后发表回答