On Monday, 14 August 2017 at 04:29:17 UTC, Johnson wrote:
```
auto valueToString(alias v)(){return v.stringof;}
enum a = valueToString!(0.75);
static assert(a == "0.75");
```
Thanks! You'd think that to would do this internally
automatically ;/
It only works on literals.
valueToString!(a) wil
On Monday, 14 August 2017 at 03:59:48 UTC, Jonathan M Davis wrote:
[snip]
Now, the fact that the mutex objects don't handle shared
correctly is another issue entirely. Having to cast away shared
from mutexes is dumb, because you're obviously not going to be
protecting them with a mutex, and t
On 8/10/17 5:10 PM, Johnson Jones wrote:
On Thursday, 10 August 2017 at 20:07:35 UTC, Steven Schveighoffer wrote:
On 8/10/17 3:36 PM, Johnson Jones wrote:
when using T[string], hashing is used. Computing the hash is
slow(relatively speaking).
Does D cache the hashes? Strings are immutable so
On 8/10/17 6:30 PM, HyperParrow wrote:
On Thursday, 10 August 2017 at 20:07:35 UTC, Steven Schveighoffer wrote:
On 8/10/17 3:36 PM, Johnson Jones wrote:
when using T[string], hashing is used. Computing the hash is
slow(relatively speaking).
Does D cache the hashes? Strings are immutable so th
On 8/13/17 11:44 PM, Adam D. Ruppe wrote:
On Monday, 14 August 2017 at 01:52:16 UTC, Johnson Jones wrote:
pretty simply, trying to convert a floating point to a string in a
ctfe function and it thinks that it is too complex to do in a ctfe,
really?
It uses a C function to do the conversion, w
On Monday, 14 August 2017 at 04:41:24 UTC, brian wrote:
Howdy folks.
Has anyone gotten an example of using D as mechanism to read in
video files, specifically from a webcam?
I don't see any OpenCV libraries, and the example in the DCV
library that uses FFMPEG, I can't get to work (I've raise
On Monday, 14 August 2017 at 13:11:20 UTC, Steven Schveighoffer
wrote:
Another reasonable idea is to have the compiler call the
function for you.
Yeah, I was thinking that too. Heck, the compiler prolly uses it
for reading source and writing errors.
Perhaps just special case hack the functio
if I use fixed-type functions, I can do the following:
uint foo(uint n)
{
++n; // modify n - as this function has received a copy of n,
this is always possible
return 42;
}
uint bar(const uint n)
{
assert(foo(n)==42);
return 17;
}
void main()
{
bar(3);
}
But if I try the same
struct mess
{
union
{
int i;
string s;
}
double x;
}
How do I cleanly initialize this, assuming it's i that I want to
give an overt value to?
The docs say "If there are anonymous unions in the struct, only
the first member of the anonymous union can be in
On 8/14/17 9:49 AM, Carl Sturtivant wrote:
struct mess
{
union
{
int i;
string s;
}
double x;
}
How do I cleanly initialize this, assuming it's i that I want to give an
overt value to?
The docs say "If there are anonymous unions in the struct, on
On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer
wrote:
I think what the docs mean is that as soon as an anonymous
union is present, you can't initialize anything further than
the first union field.
I understood that, hence my remark that "this is not helpful".
So it seems I
On 8/14/17 10:36 AM, Carl Sturtivant wrote:
On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote:
I think what the docs mean is that as soon as an anonymous union is
present, you can't initialize anything further than the first union
field.
I understood that, hence my remar
On Monday, 14 August 2017 at 14:49:57 UTC, Steven Schveighoffer
wrote:
On 8/14/17 10:36 AM, Carl Sturtivant wrote:
On Monday, 14 August 2017 at 14:24:40 UTC, Steven
Schveighoffer wrote:
I think what the docs mean is that as soon as an anonymous
union is present, you can't initialize anything
On Monday, 14 August 2017 at 13:48:36 UTC, Dominikus Dittes
Scherkl wrote:
if I use fixed-type functions, I can do the following:
uint foo(uint n)
{
++n; // modify n - as this function has received a copy of
n, this is always possible
return 42;
}
uint bar(const uint n)
{
assert(foo(
On 8/14/17 10:57 AM, Carl Sturtivant wrote:
On Monday, 14 August 2017 at 14:49:57 UTC, Steven Schveighoffer wrote:
On 8/14/17 10:36 AM, Carl Sturtivant wrote:
On Monday, 14 August 2017 at 14:24:40 UTC, Steven Schveighoffer wrote:
I think what the docs mean is that as soon as an anonymous unio
On 8/14/17 9:48 AM, Dominikus Dittes Scherkl wrote:
if I use fixed-type functions, I can do the following:
uint foo(uint n)
{
++n; // modify n - as this function has received a copy of n, this
is always possible
return 42;
}
uint bar(const uint n)
{
assert(foo(n)==42);
return
On Monday, 14 August 2017 at 15:11:35 UTC, Steven Schveighoffer
wrote:
On 8/14/17 10:57 AM, Carl Sturtivant wrote:
On Monday, 14 August 2017 at 14:49:57 UTC, Steven
Schveighoffer wrote:
On 8/14/17 10:36 AM, Carl Sturtivant wrote:
On Monday, 14 August 2017 at 14:24:40 UTC, Steven
Schveighoffer
On Monday, 14 August 2017 at 15:20:28 UTC, Steven Schveighoffer
wrote:
On 8/14/17 9:48 AM, Dominikus Dittes Scherkl wrote:
> uint foo(T)(Unqual!T n) // first try
> {
> ++n; // modify should be possible
> return 42;
> }
> Any ideas what I need to do to make this work?
This isn't exactly s
On Monday, 14 August 2017 at 03:40:26 UTC, Jonathan M Davis wrote:
On Saturday, August 12, 2017 18:57:44 Arek via
Digitalmars-d-learn wrote:
I have the folowing problem:
I like to envelope the class object in struct to control the
destruction moment and then send this object to another
thread/fi
On 8/13/17 11:40 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Saturday, August 12, 2017 18:57:44 Arek via Digitalmars-d-learn wrote:
I have the folowing problem:
I like to envelope the class object in struct to control the
destruction moment and then send this object to another
thread/
On Monday, 14 August 2017 at 03:59:48 UTC, Jonathan M Davis wrote:
On Sunday, August 13, 2017 16:40:03 crimaniak via
Digitalmars-d-learn wrote:
More of this, I think, you can't avoid __gshared for any
complex work. Even mutexes from Phobos doesn't support shared,
so I had to 'cowboy with __gsha
On Monday, 14 August 2017 at 19:22:23 UTC, Steven Schveighoffer
wrote:
On 8/13/17 11:40 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
On Saturday, August 12, 2017 18:57:44 Arek via
Digitalmars-d-learn wrote:
I have the folowing problem:
I like to envelope the class object in struct to con
On Monday, August 14, 2017 15:22:23 Steven Schveighoffer via Digitalmars-d-
learn wrote:
> On 8/13/17 11:40 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > On Saturday, August 12, 2017 18:57:44 Arek via Digitalmars-d-learn
wrote:
> >> I have the folowing problem:
> >> I like to envelope th
On Monday, 14 August 2017 at 17:43:44 UTC, Dominikus Dittes
Scherkl wrote:
On Monday, 14 August 2017 at 15:20:28 UTC, Steven Schveighoffer
wrote:
What you can do, is:
auto foo(T)(T n) if (is(T == Unqual!T))
{
// normal implementation
}
auto foo(T)(T n) if (!is(T == Unqual!T) &&
isImplicitl
On Monday, 14 August 2017 at 21:27:48 UTC, Jonathan M Davis wrote:
On Monday, August 14, 2017 15:22:23 Steven Schveighoffer via
Digitalmars-d- learn wrote:
On 8/13/17 11:40 PM, Jonathan M Davis via Digitalmars-d-learn
wrote:
> On Saturday, August 12, 2017 18:57:44 Arek via
> Digitalmars-d-learn
On Monday, August 14, 2017 17:43:44 Dominikus Dittes Scherkl via
Digitalmars-d-learn wrote:
> On Monday, 14 August 2017 at 15:20:28 UTC, Steven Schveighoffer
>
> wrote:
> > On 8/14/17 9:48 AM, Dominikus Dittes Scherkl wrote:
> > > uint foo(T)(Unqual!T n) // first try
> > > {
> > >
> > > ++n; /
On 08/15/2017 12:14 AM, Dominikus Dittes Scherkl wrote:
T foo(T)(T n)
{
static if(!is(Unqual!T == T)) return foo!(Unqual!T)(n);
else
{
// normal implementation
}
}
So it's basically 2 lines of overhead. That's acceptable. The check for
isImplicitlyConvertible is not nece
On 2017-08-13 19:51, Adam D. Ruppe wrote:
On Sunday, 13 August 2017 at 15:54:45 UTC, Faux Amis wrote:
Just curious, but is there a spec of sorts which defines which errors
should be fixed and such?
The HTML5 spec describes how you are supposed to parse various things,
including the recovery p
On Monday, 14 August 2017 at 23:15:13 UTC, Faux Amis wrote:
(Althought following the spec would be the first step to a D
html layout engine :D )
Oh, I've actually done some of that before too.
https://github.com/adamdruppe/arsd/blob/master/htmlwidget.d
It is pretty horrible... but managed to
Hello!
I'm having issues with the format function.
My program is as follows:
import std.format;
import std.stdio;
int main ()
{
auto s = format!"%s is %s"("Pi", 3.14);
writeln(s); // "Pi is 3.14";
}
and when compiling with GDC, I'm getting this error:
test.d:8: erro
On Tuesday, 15 August 2017 at 04:44:25 UTC, LeqxLeqx wrote:
Hello!
I'm having issues with the format function.
My program is as follows:
import std.format;
import std.stdio;
int main ()
{
auto s = format!"%s is %s"("Pi", 3.14);
writeln(s); // "Pi is 3.14";
}
and when
31 matches
Mail list logo