On Saturday, 26 September 2020 at 23:23:13 UTC, Adam D. Ruppe
wrote:
As a result, you `add` works fine
I'm afraid not. __traits(isStaticFunction, add) is false, I think
it's because it checks if it is a static member function of some
struct/class. How would I check if it is actually a free
On Sunday, 27 September 2020 at 03:33:20 UTC, Mike Parker wrote:
package.d is for your external interface.
Fair enough, thanks.
On Saturday, 26 September 2020 at 22:43:10 UTC, 60rntogo wrote:
OK, sure. It's just that the motivation behind doing public
imports in package.d is that I can write "import pack" instead
of "import pack.foo". I guess it simply doesn't work within the
package itself.
package.d is for your
On Saturday, 26 September 2020 at 22:58:44 UTC, 60rntogo wrote:
I get the error "undefined identifier isValid". How can I make
this work?
This part is easy, you need to give the name like
assert(invoke!(Foo.isValid)(foo, 3));
Now, the other part is tricky, and a new feature just released
I tried this:
---
auto invoke(alias fun, Args...)(Args args)
{
return fun(args);
}
---
which works with free functions:
---
int add(int a, int b)
{
return a + b;
}
assert(invoke!add(1, 2) == 3);
---
but with a method:
---
struct Foo
{
bool isValid(int a)
{
return a > 0;
}
}
On Friday, 25 September 2020 at 18:58:54 UTC, H. S. Teoh wrote:
You probably need to use the long-form of templates, with
separate function declarations, to accomplish this. E.g.:
...
Alright, but your example still contains shouldReturnByRef which
presumably I need to implement myself. But
On Saturday, 26 September 2020 at 15:12:47 UTC, Steven
Schveighoffer wrote:
Instead:
import pack.foo : Foo;
Works.
OK, sure. It's just that the motivation behind doing public
imports in package.d is that I can write "import pack" instead of
"import pack.foo". I guess it simply doesn't work
On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote:
Hi,
struct S{int a, b, c=9, d, e, f;}
Is there a way or a trick to declare an UDA by using a nice
struct initializer?
It would be nice to be able to use the form:
@S{f:42} int a; //or something similar to this.
instead of
Hi,
struct S{int a, b, c=9, d, e, f;}
Is there a way or a trick to declare an UDA by using a nice
struct initializer?
It would be nice to be able to use the form:
@S{f:42} int a; //or something similar to this.
instead of this longer and error-prone way:
@S(0, 0, 0, 9, 0, 42) int
On 9/26/20 10:59 AM, 60rntogo wrote:
On Saturday, 26 September 2020 at 13:45:21 UTC, Steven Schveighoffer wrote:
A selective import is equivalent to aliasing (to the public) the
symbol as if it were defined in that scope.
You have to label it as private if you want it to be private.
Are you
On Saturday, 26 September 2020 at 13:45:21 UTC, Steven
Schveighoffer wrote:
A selective import is equivalent to aliasing (to the public)
the symbol as if it were defined in that scope.
You have to label it as private if you want it to be private.
Are you saying that I should write this in
On 9/26/20 3:33 AM, 60rntogo wrote:
I have a package with the following structure:
pack
|- foo.d
|- bar.d
|- package.d
and the modules look like this:
---
module pack.foo;
struct Foo {}
---
module pack.bar;
import pack : Foo;
---
module pack;
public import pack.foo, pack.bar;
---
and this
On Saturday, 26 September 2020 at 10:26:15 UTC, IGotD- wrote:
One thing that struck me looking at the source code of scoped,
would scoped work inside a class and not only for stack
allocations?
It does work, the problem is that scoped returns a Voldemort
type, so you have to use
One thing that struck me looking at the source code of scoped,
would scoped work inside a class and not only for stack
allocations?
We know that classes are all reference typed so that classes must
be allocated on the heap. However, this memory could be taken
from anywhere so basically this memory could be a static array
inside the class. This is pretty much what the scoped template
does when allocating a class on the
I have a package with the following structure:
pack
|- foo.d
|- bar.d
|- package.d
and the modules look like this:
---
module pack.foo;
struct Foo {}
---
module pack.bar;
import pack : Foo;
---
module pack;
public import pack.foo, pack.bar;
---
and this is an error: "struct pack.foo.Foo at
On Friday, 25 September 2020 at 15:03:56 UTC, Marcone wrote:
I need windowsx.d but for I don't know the reason is not in
dmd. Someone that have it can send to me? I don't know convert
windowsx.h to windowsx.d
windowsx.h is mostly a bunch of macros that forward to functions
elsewhere in the
17 matches
Mail list logo