I use this code to get member function address on runtime:
=
struct A {
this(){};
}
auto ctor = (&__traits(getMember, A.init,"__ctor")).funcptr;
=
my question is, how to get it in compile time like static
function address:
=
struct A {
void d(){};
sta
On Friday, 13 March 2020 at 20:31:16 UTC, Steven Schveighoffer
wrote:
On 3/13/20 4:22 PM, wjoe wrote:
I would expect that something could be written to turn a
signature string into a mangling and also provide the correct
type upon return. Something like:
auto f = getFunction!(@safe void
func
I.E.
switch (object)
case Type1 t1:
case Type2 t2:
case Type3 t3:
On Saturday, 14 March 2020 at 19:04:28 UTC, 12345swordy wrote:
I.E.
switch (object)
case Type1 t1:
case Type2 t2:
case Type3 t3:
You can use the sumtype package
(https://code.dlang.org/packages/sumtype):
alias T = SumType!(Type1, Type2, Type3);
T(object).match!(
(Type1 t1)
On Saturday, 14 March 2020 at 19:04:28 UTC, 12345swordy wrote:
I.E.
switch (object)
case Type1 t1:
case Type2 t2:
case Type3 t3:
As far as I know, there's no way to do that in a switch.
However, you can do something like this:
---
void main()
{
auto i = new Type1();
foo(i)
I would like to export some functions from my bettec dll for
dotnet core application in windows.
Right now I have compiled dll using dmd v2.091.0-dirty simply by
´dub build´
this is the function I have
extern(C) char* test_echo(const(char)* line, size_t len, ref
size_t resLen)
{
enum
https://dlang.org/library/std/mmfile/mm_file.html doesn't seem to
specify anything similar to lines() or byLine() or byLineCopy()
etc.
In the following code the compiler says the type is
Array!()(string):
if (key in wordTable)
wordTable[key] ~= word;
else
wordTable[key] = Array!string(word);
source/app.d(29,36): Err
On Saturday, 14 March 2020 at 20:52:30 UTC, aliak wrote:
On Saturday, 14 March 2020 at 19:04:28 UTC, 12345swordy wrote:
[...]
You can use the sumtype package
(https://code.dlang.org/packages/sumtype):
[...]
That simply to much verbiage.
On Saturday, 14 March 2020 at 23:39:11 UTC, Adnan wrote:
In the following code the compiler says the type is
Array!()(string):
if (key in wordTable)
wordTable[key] ~= word;
else
wordT
On Saturday, 14 March 2020 at 23:39:11 UTC, Adnan wrote:
Full code
this worked for me when i copy/pasted it... are you sure that has
the error? if so what compiler version you on?
On Saturday, 14 March 2020 at 23:54:44 UTC, Adam D. Ruppe wrote:
On Saturday, 14 March 2020 at 23:39:11 UTC, Adnan wrote:
Full code
this worked for me when i copy/pasted it... are you sure that
has the error? if so what compiler version you on?
This is indeed very strange, godbolt says it's
On Sunday, 15 March 2020 at 00:04:09 UTC, Adnan wrote:
On Saturday, 14 March 2020 at 23:54:44 UTC, Adam D. Ruppe wrote:
On Saturday, 14 March 2020 at 23:39:11 UTC, Adnan wrote:
Full code
this worked for me when i copy/pasted it... are you sure that
has the error? if so what compiler version
On Sat, Mar 14, 2020 at 10:37:37PM +, Adnan via Digitalmars-d-learn wrote:
> https://dlang.org/library/std/mmfile/mm_file.html doesn't seem to
> specify anything similar to lines() or byLine() or byLineCopy() etc.
That's because a memory-mapped file appears directly in your program's
memory ad
On Saturday, 14 March 2020 at 20:53:45 UTC, Abby wrote:
I would like to export some functions from my bettec dll for
dotnet core application in windows.
[...]
It is the calling convention.
How catch any error in Dlang like Python tray-except?
It is very useful when making tests. But only who came from
interpreted languages can understand.
Exemple:
import std;
void main()
{
try {
writelnX("try function that not exist");
} catch (Throwable
On Sunday, 15 March 2020 at 02:11:21 UTC, Marcone wrote:
It is very useful when making tests. But only who came from
interpreted languages can understand.
The compiler catches all compile errors. It is impossible to even
run a program if there is even a single compile error. Thus they
cannot
On Saturday, 14 March 2020 at 20:53:45 UTC, Abby wrote:
I would like to export some functions from my bettec dll for
dotnet core application in windows.
Right now I have compiled dll using dmd v2.091.0-dirty simply
by ´dub build´
this is the function I have
extern(C) char* test_echo(const(c
18 matches
Mail list logo