March 11, 2013
This has become a C++ thread but... :)

On 03/11/2013 02:30 AM, FG wrote:

> the good old stream code:
>
> std::stringstream ss; ss << number; out = ss.str();
>
> Seriously? If I could at least chain that...
>
> out = std::stringstream(number).str();
>
> Unfortunately, no.

We consider Boost a part of the C++ standard:

#include <boost/lexical_cast.hpp>

using namespace boost;

// ...

    out = lexical_cast<string>(number);

Ali

March 11, 2013
11-Mar-2013 13:30, FG пишет:
> On 2013-03-11 06:22, H. S. Teoh wrote:
>>    And now it's 2013 and g++ is still defaulting to the *old* C++?!
>
> I don't mind having to add -std=c++11 as much as dealing with its
> incomplete implementation. Still have to use the pcre library for
> regular expressions.
> http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x
> Waiting gets me nervous, so in the mean time I'll rather write more D.
>

I'd strongly suggest using Boost regex library. C++11 regex is modeled after it anyway. And unless some miracle happened during the last year PCRE is still one of the slowest (of those I benched). Boost is very fast with most of _common_ patterns and generally quite nice.



-- 
Dmitry Olshansky
March 11, 2013
On 3/11/13 1:39 PM, Ali Çehreli wrote:
> This has become a C++ thread but... :)
>
> On 03/11/2013 02:30 AM, FG wrote:
>
>  > the good old stream code:
>  >
>  > std::stringstream ss; ss << number; out = ss.str();
>  >
>  > Seriously? If I could at least chain that...
>  >
>  > out = std::stringstream(number).str();
>  >
>  > Unfortunately, no.
>
> We consider Boost a part of the C++ standard:
>
> #include <boost/lexical_cast.hpp>
>
> using namespace boost;
>
> // ...
>
> out = lexical_cast<string>(number);

Problem with that it's it's incredibly slow (both ways).

Andrei

March 11, 2013
On Monday, 11 March 2013 at 19:25:47 UTC, Andrei Alexandrescu wrote:
> On 3/11/13 1:39 PM, Ali Çehreli wrote:
>> This has become a C++ thread but... :)
>>
>> On 03/11/2013 02:30 AM, FG wrote:
>>
>> > the good old stream code:
>> >
>> > std::stringstream ss; ss << number; out = ss.str();
>> >
>> > Seriously? If I could at least chain that...
>> >
>> > out = std::stringstream(number).str();
>> >
>> > Unfortunately, no.
>>
>> We consider Boost a part of the C++ standard:
>>
>> #include <boost/lexical_cast.hpp>
>>
>> using namespace boost;
>>
>> // ...
>>
>> out = lexical_cast<string>(number);
>
> Problem with that it's it's incredibly slow (both ways).
>
> Andrei

Speaking of which, I noticed Facebook's Folly had a conv.h with a to<>.  Was that inspired by Phobos' std.conv?

https://github.com/facebook/folly/blob/master/folly/docs/Conv.md
March 11, 2013
On 3/10/2013 5:47 PM, Rob T wrote:
> A good start is to support a particular industry that no one else is currently
> catering to in enough detail. If we could figure out who is using D commercially
> to try and figure out what is seen as being the main strengths, then the
> language and its libraries could be strengthen further in those areas.

I get many answers to this question I put to commercial users, and get lots of different answers. But one that is common is compile speed.

March 11, 2013
On 3/11/13 3:31 PM, Brad Anderson wrote:
> Speaking of which, I noticed Facebook's Folly had a conv.h with a to<>.
> Was that inspired by Phobos' std.conv?
>
> https://github.com/facebook/folly/blob/master/folly/docs/Conv.md

We use some text file formats (notably Hadoop/Hive) which require extensive conversions string <-> integrals. I wrote folly's conv, so of course it was inspired from Phobos.

Andrei
1 2
Next ›   Last »