On Saturday, 14 August 2021 at 04:01:31 UTC, Mike Parker wrote:
On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote:
```d
import std;
auto abc(T)(auto ref T a, auto ref T b){
return a+b;
}
auto def(T)(auto ref T a, auto ref T b){
return a*b;
}
alias macro_1 = abc;
void main()
On Saturday, 14 August 2021 at 03:47:05 UTC, Tejas wrote:
```d
import std;
auto abc(T)(auto ref T a, auto ref T b){
return a+b;
}
auto def(T)(auto ref T a, auto ref T b){
return a*b;
}
alias macro_1 = abc;
void main()
{
writeln(macro_1(15, 20));
alias macro_1 = def;// is
```d
import std;
auto abc(T)(auto ref T a, auto ref T b){
return a+b;
}
auto def(T)(auto ref T a, auto ref T b){
return a*b;
}
alias macro_1 = abc;
void main()
{
writeln(macro_1(15, 20));
alias macro_1 = def;// is this NOT considered variable
shadowing?
On Friday, 13 August 2021 at 21:36:35 UTC, Ruby The Roobster
wrote:
Thank you very much. The program runs successfully now.
You've got another potential issue you should be aware of. You've
name a member of your `Skeleton` as `init`. This may cause issues
at some point, as every type in
On Friday, 13 August 2021 at 21:10:38 UTC, Steven Schveighoffer
wrote:
Well, subtracting the length doesn't do much, you aren't
actually accessing the array block, you are just changing the
reference (which lives in thread-local storage). I kind of feel
like the whole entity table thing is
On Fri, Aug 13, 2021 at 04:35:54PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 8/13/21 4:23 PM, Marcone wrote:
>
> > string x = "Hello World!";
> > writeln(x[x.indexOf("e")..x.indexOf("r")]);
>
> I don't see the usefulness and there are the following problems with
> it:
>
> - Not an
On 8/13/21 7:23 PM, Marcone wrote:
On Friday, 13 August 2021 at 23:08:07 UTC, jfondren wrote:
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with lambda
to handle a string literal?
So, something other than an exact
On Friday, 13 August 2021 at 23:21:42 UTC, Ali Çehreli wrote:
On 8/13/21 4:08 PM, jfondren wrote:
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with
lambda to handle a string literal?
So, something other than an exact
On 8/13/21 4:23 PM, Marcone wrote:
> string x = "Hello World!";
> writeln(x[x.indexOf("e")..x.indexOf("r")]);
I don't see the usefulness and there are the following problems with it:
- Not an algorithmic complexity issue but it sounds to me like a
pessimization to go through the elements in
On Friday, 13 August 2021 at 23:23:55 UTC, Marcone wrote:
writeln("Hello World!"[x.indexOf("e")..x.indexOf("r")]);
indexOf()is just a simple example, not the goal. I want handle
literal inside [] like it bellow, but in literal:
string x = "Hello World!";
On Friday, 13 August 2021 at 23:23:55 UTC, Marcone wrote:
On Friday, 13 August 2021 at 23:08:07 UTC, jfondren wrote:
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with
lambda to handle a string literal?
So, something
On Friday, 13 August 2021 at 23:08:07 UTC, jfondren wrote:
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with
lambda to handle a string literal?
So, something other than an exact "lit"[0..this.xx(..)] syntax
is fine?
On 8/13/21 4:08 PM, jfondren wrote:
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with lambda
to handle a string literal?
So, something other than an exact "lit"[0..this.xx(..)] syntax is fine?
What didn't you like about
On Friday, 13 August 2021 at 22:09:59 UTC, Marcone wrote:
Isn't there some unario operator template that I can use with
lambda to handle a string literal?
So, something other than an exact "lit"[0..this.xx(..)] syntax is
fine?
What didn't you like about `"Hello
On Friday, 13 August 2021 at 21:10:38 UTC, Steven Schveighoffer
wrote:
On 8/13/21 3:59 PM, Mike Parker wrote:
On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster
wrote:
...
...
...
Well, subtracting the length doesn't do much, you aren't
actually accessing the array block, you
On Friday, 13 August 2021 at 21:47:22 UTC, Steven Schveighoffer
wrote:
On 8/13/21 5:05 PM, Marcone wrote:
How to extend the string class to return this inside the
square bracket the same way opDollar $ returns the length of
the string? Thank you.
import std;
void main(){
On Friday, 13 August 2021 at 21:34:29 UTC, Steven Schveighoffer
wrote:
But for constructors it's not the same. Essentially because
constructors have different rules for what they can do with
their inputs (the inout `this` parameter can be assigned to for
the member's first assignment).
What
On 8/13/21 5:05 PM, Marcone wrote:
How to extend the string class to return this inside the square bracket
the same way opDollar $ returns the length of the string? Thank you.
import std;
void main(){
writeln("Hello World!"[0..this.indexOf("o")]);
}
There is no
On Friday, 13 August 2021 at 19:59:46 UTC, Mike Parker wrote:
You aren't supposed to be manipulating GC-managed memory via
class destructors. You can not rely on that memory being valid
at the time that it's accessed in the destructor---the object
may already have been destroyed.
On 8/13/21 4:58 PM, Paul Backus wrote:
On Friday, 13 August 2021 at 15:26:15 UTC, Steven Schveighoffer wrote:
The issue is that you can't convert const (or immutable or mutable) to
inout implicitly, and the member variable is inout inside an inout
constructor. Therefore, there's no viable copy
On Friday, 13 August 2021 at 21:14:29 UTC, user1234 wrote:
On Friday, 13 August 2021 at 21:05:22 UTC, Marcone wrote:
How to extend the string class to return this inside the
square bracket the same way opDollar $ returns the length of
the string? Thank you.
import std;
void main(){
On Friday, 13 August 2021 at 21:05:22 UTC, Marcone wrote:
How to extend the string class to return this inside the square
bracket the same way opDollar $ returns the length of the
string? Thank you.
import std;
void main(){
writeln("Hello World!"[0..this.indexOf("o")]);
}
On 8/13/21 3:59 PM, Mike Parker wrote:
On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster wrote:
Context for this: I am creating a module of my own, and this is a
class contained in the module. You will notice that after calling
this class' constructor anywhere in a Win32 API
How to extend the string class to return this inside the square
bracket the same way opDollar $ returns the length of the string?
Thank you.
import std;
void main(){
writeln("Hello World!"[0..this.indexOf("o")]);
}
On Friday, 13 August 2021 at 15:26:15 UTC, Steven Schveighoffer
wrote:
The issue is that you can't convert const (or immutable or
mutable) to inout implicitly, and the member variable is inout
inside an inout constructor. Therefore, there's no viable copy
constructor to call for the member,
On Friday, 13 August 2021 at 16:18:06 UTC, Ruby The Roobster
wrote:
Context for this: I am creating a module of my own, and this
is a class contained in the module. You will notice that after
calling this class' constructor anywhere in a Win32 API
program, that the program doesn't close
On Friday, 13 August 2021 at 19:06:17 UTC, JG wrote:
Anyway I hope it is clearer what I mean. Is it possible to do
this in d?
union S
{
int x;
int a;
}
void main()
{
S s= S(1234);
writeln(s.a); //displays 1234
s.x = s.x+1;
writeln(s.a); //displays 1235
s.a = s.a +1;
On Friday, 13 August 2021 at 17:19:43 UTC, H. S. Teoh wrote:
On Fri, Aug 13, 2021 at 05:11:50PM +, Rekel via
Digitalmars-d-learn wrote: [...]
For anyone more experienced with C, I'm not well known with
references but are those semantically similar to the idea of
using a type at a
On Fri, Aug 13, 2021 at 05:11:50PM +, Rekel via Digitalmars-d-learn wrote:
[...]
> For anyone more experienced with C, I'm not well known with references
> but are those semantically similar to the idea of using a type at a
> predefined location?
References are essentially pointers under the
On Friday, 13 August 2021 at 09:10:18 UTC, Tejas wrote:
On Friday, 13 August 2021 at 08:25:33 UTC, JG wrote:
Suppose one has a pointer p of type T*.
Can on declare variable a of type T which is stored in the
location pointed to by p?
Umm is this what you want?
```d
import std.stdio;
struct S
I found a this thread about testing libraries:
https://forum.dlang.org/post/mailman.1807.1522279261.3374.digitalmars-d-le...@puremagic.com
But it's very old, yet I have the same issue today.
I want to build a unittest executable for the library I've made,
but given I'm trying to use the vscode
On Friday, 13 August 2021 at 03:05:22 UTC, Mike Parker wrote:
On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster
wrote:
When I run the program and close the window, the program still
runs in background mode. I don't know why this happens nor
how to fix it. Does anybody know
On Friday, 13 August 2021 at 15:14:00 UTC, Steven Schveighoffer
wrote:
There isn't a way to alias it. You can wrap it though, and hope
the inliner takes care of the difference:
```d
auto foo(T)(T arg)
{
static if(is(T == int)) return bar(arg, 42.33);
else return bar(7, arg);
}
```
On 8/12/21 12:12 PM, Paul Backus wrote:
The reason for this is a bit subtle. Normally, `inout` can convert to
`const`, so you might expect that the `const` copy constructor could be
used to construct a copy of an `inout` object. However, copy
constructors take their arguments by `ref`, and
On 8/13/21 11:04 AM, james.p.leblanc wrote:
Dear All,
How does one use 'alias' to incorporate function arguments as well?
(I believe this is possible, from some of the examples of aliasSeq, and
the traits.Parameters documentation. However, I was unable to come up
with anything that works.)
Dear All,
How does one use 'alias' to incorporate function arguments as
well?
(I believe this is possible, from some of the examples of
aliasSeq, and
the traits.Parameters documentation. However, I was unable to
come up
with anything that works.)
What should replace the question marks
On Friday, 13 August 2021 at 03:05:22 UTC, Mike Parker wrote:
On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster
wrote:
When I run the program and close the window, the program still
runs in background mode. I don't know why this happens nor
how to fix it. Does anybody know
On Friday, 13 August 2021 at 03:05:22 UTC, Mike Parker wrote:
On Friday, 13 August 2021 at 00:30:59 UTC, Ruby The Roobster
wrote:
When I run the program and close the window, the program still
runs in background mode. I don't know why this happens nor
how to fix it. Does anybody know
On Friday, 13 August 2021 at 09:30:25 UTC, Ali Çehreli wrote:
(core.lifetime is not on dlang.org at the moment for me but it
is under /usr/include/dmd/druntime/import/core on my computer.)
It's also on dpldocs.info:
https://dpldocs.info/experimental-docs/core.lifetime.html
On 8/13/21 1:25 AM, JG wrote:
> Suppose one has a pointer p of type T*.
> Can on declare variable a of type T which is stored in the location
> pointed to by p?
You may be looking for core.lifetime.emplace. (core.lifetime is not on
dlang.org at the moment for me but it is under
On Friday, 13 August 2021 at 08:25:33 UTC, JG wrote:
Suppose one has a pointer p of type T*.
Can on declare variable a of type T which is stored in the
location pointed to by p?
As an example if we have:
struct S
{
int x = 1234;
}
void main() {
S s;
Suppose one has a pointer p of type T*.
Can on declare variable a of type T which is stored in the
location pointed to by p?
As an example if we have:
struct S
{
int x = 1234;
}
void main() {
S s;
//unknown construction of a using &(s.x)
writeln(a);
42 matches
Mail list logo