问题
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:
I think stringWithFormat might do the trick:
NSString *string = [NSString stringWithFormat:@"%d/best_weight_Bias%d_LR%Lf.xml", pathWeightBias, MaxEpochs, learning_Value];
来源:https://stackoverflow.com/questions/21118842/how-to-convert-long-double-to-string-format-in-xcode-or-how-to-solve-error-us