Diego Novillo via llvm-dev
2015-Nov-28 16:14 UTC
[llvm-dev] Need help with windows build error and std::to_string
I need to build a Twine with a double value, so I was using std::to_string, but I'm getting "error: 'to_string' is not a member of 'std'" from a windows buildbot. What's the canonical way to create a Twine() out of a double? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151128/8505be03/attachment.html>
Benjamin Kramer via llvm-dev
2015-Nov-28 16:44 UTC
[llvm-dev] Need help with windows build error and std::to_string
On Sat, Nov 28, 2015 at 5:14 PM, Diego Novillo via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > I need to build a Twine with a double value, so I was using std::to_string, > but I'm getting "error: 'to_string' is not a member of 'std'" from a windows > buildbot. What's the canonical way to create a Twine() out of a double?via raw_ostream. Create a new raw_string_ostream or raw_svector_ostream, << the double into it and take the string. I don't think we have a more convenient way for that currently and to_string is still not universally available. - Ben
Diego Novillo via llvm-dev
2015-Nov-28 22:03 UTC
[llvm-dev] Need help with windows build error and std::to_string
Thanks. I On Sat, Nov 28, 2015 at 11:44 AM, Benjamin Kramer <benny.kra at gmail.com> wrote:> On Sat, Nov 28, 2015 at 5:14 PM, Diego Novillo via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > I need to build a Twine with a double value, so I was using > std::to_string, > > but I'm getting "error: 'to_string' is not a member of 'std'" from a > windows > > buildbot. What's the canonical way to create a Twine() out of a double? > > via raw_ostream. Create a new raw_string_ostream or > raw_svector_ostream, << the double into it and take the string. I > don't think we have a more convenient way for that currently and > to_string is still not universally available. >Thanks. I suppose there's no easy way to format them? I tried the standard io manipulators, but they don't seem to be supported in raw streams. By default double values are emitted in scientific notation. I need to format them as percentage values. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151128/c48c06b0/attachment.html>