Given following code:
enum ErrorCode {
BAD_REQUEST,
UNKNOWN
}
ErrorCode code;
is there any way to get string representation of code with regard to values
defined in enum? I mean - if code == 0, I'd like to get a string
"BAD_REQUEST", if it's == 1, I'd like to get string a "UNKNOWN". Of cou
On Sunday, 4 August 2013 at 13:57:20 UTC, Marek Janukowicz wrote:
Given following code:
enum ErrorCode {
BAD_REQUEST,
UNKNOWN
}
ErrorCode code;
is there any way to get string representation of code with
regard to values
defined in enum? I mean - if code == 0, I'd like to get a string
"BA
Robik wrote:
> I think std.conv.to!string is what are you looking for :)
>
> http://dpaste.dzfl.pl/e1c38f8f
Wow, so simple, thanks
--
Marek Janukowicz
On 08/03/2013 09:05 AM, monarch_dodra wrote:
> On Saturday, 3 August 2013 at 15:10:20 UTC, Ali Çehreli wrote:
>> On 08/03/2013 07:58 AM, bearophile wrote:
>>
>> > Gabi:
>> >
>> >> //HOW TO pass F1(..) the args we were called with ?
>> >
>> >
>> > import std.stdio;
>> >
>> > void f1(Args...)(Arg
David Nadlinger wrote:
> See
>
https://github.com/apache/thrift/blob/master/lib/d/src/thrift/server/transport/socket.d#L144
> for a production-tested implementation. When I wrote that code,
> it wasn't possible to do this in a platform-independent way using
> std.socket (see
>
https://github.com/
On Sunday, 4 August 2013 at 15:29:48 UTC, Ali Çehreli wrote:
On 08/03/2013 09:05 AM, monarch_dodra wrote:
> On Saturday, 3 August 2013 at 15:10:20 UTC, Ali Çehreli wrote:
>> On 08/03/2013 07:58 AM, bearophile wrote:
>>
>> > Gabi:
>> >
>> >> //HOW TO pass F1(..) the args we were called with ?
>
Trying to avoid GC dependence on my objects.
interface Alloc(T)
{
T New(A...)(A args);
//final T Factory(A...)(T, A args) { return new T(args); }
}
class A(T) : Alloc!(A!(T))
{
static A!T New()
{
return new A!T();// Use GC for now
// Factor(A