On Thursday, 20 June 2019 at 00:30:35 UTC, Jonathan M Davis wrote:
Ultimately, if you want a function to accept both rvalues and
lvalues as efficiently as posible, just templatize it and use
auto ref.
I'm aware of auto ref, and I've used it to solve this same
problem when I had a template,
On Thursday, 20 June 2019 at 01:06:09 UTC, Alex wrote:
Is there a way of creating and initialising a dynamic array ?
for example I am doing this:
auto arr = new float[];
arr[] = 0.0f;
Profiling indicates that the compiler (gdc) is spending
significant time memsetting the whole array to
Is there a way of creating and initialising a dynamic array ?
for example I am doing this:
auto arr = new float[];
arr[] = 0.0f;
Profiling indicates that the compiler (gdc) is spending
significant time memsetting the whole array to something (nan ?)
before I immediately memset it to 0.0f.
On Wednesday, June 19, 2019 4:45:04 PM MDT XavierAP via Digitalmars-d-learn
wrote:
> On Wednesday, 19 June 2019 at 21:06:48 UTC, XavierAP wrote:
> > Now with an rvalue returned from get, interesting, no copy.
> > Still, I wonder what really happened. Again, moving between
> > stacks would still
On Wednesday, 19 June 2019 at 20:18:58 UTC, Max Haughton wrote:
On Wednesday, 19 June 2019 at 19:25:59 UTC, Jonathan M Davis
wrote:
On Wednesday, June 19, 2019 12:28:12 PM MDT XavierAP via
Digitalmars-d-learn wrote:
[...]
The DIPs are here: https://github.com/dlang/DIPs
[...]
DIP1014 has
On Wednesday, 19 June 2019 at 17:28:38 UTC, XavierAP wrote:
Also, the return type of SDL_LoadBMP is a pointer, SDL_Surface*
not just SDL_Surface.
Or just use auto of course if you prefer:
void load (string path)
{
import std.string : toStringz;
auto ab = SDL_LoadBMP
On Wednesday, 19 June 2019 at 21:06:48 UTC, XavierAP wrote:
Now with an rvalue returned from get, interesting, no copy.
Still, I wonder what really happened. Again, moving between
stacks would still be work. And a different optimization can
explain this non copy, for example inlining.
My
On Wednesday, 19 June 2019 at 21:21:53 UTC, XavierAP wrote:
On Wednesday, 19 June 2019 at 18:56:57 UTC, BoQsc wrote:
I would like to make sure that my modules do not interfere
with d lang. Is there any way to escape reserved words?
The only reason C# allows this is for interop or code
On Wednesday, 19 June 2019 at 18:56:57 UTC, BoQsc wrote:
I would like to make sure that my modules do not interfere with
d lang. Is there any way to escape reserved words?
The only reason C# allows this is for interop or code generation
for other languages that use the same keyword. For
On Wednesday, 19 June 2019 at 19:07:30 UTC, Jonathan M Davis
wrote:
On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via
Digitalmars-d-learn wrote:
I would like to make sure that my modules do not interfere
with d lang. Is there any way to escape reserved words?
Hmmm I know about move semantics, and C++11 etc. I just don't
know how related all that is to my original question. :)
On Wednesday, 19 June 2019 at 19:25:59 UTC, Jonathan M Davis
wrote:
though if I understand correctly with RVO, it may just place
the return value outside of the function in
On Wednesday, 19 June 2019 at 19:25:59 UTC, Jonathan M Davis
wrote:
On Wednesday, June 19, 2019 12:28:12 PM MDT XavierAP via
Digitalmars-d-learn wrote:
[...]
The DIPs are here: https://github.com/dlang/DIPs
[...]
DIP1014 has not been implemented in DMD or druntime yet, AFAIK
On Wednesday, June 19, 2019 12:28:12 PM MDT XavierAP via Digitalmars-d-learn
wrote:
> On Wednesday, 19 June 2019 at 12:55:09 UTC, Jonathan M Davis
>
> wrote:
> > Even in C++, using const ref is not as good a practice as it
> > once was, because they added move constructors, finally making
> >
On Wednesday, June 19, 2019 12:56:57 PM MDT BoQsc via Digitalmars-d-learn
wrote:
> I would like to make sure that my modules do not interfere with d
> lang. Is there any way to escape reserved words?
> https://dlang.org/spec/lex.html#keywords
>
> > import alias;
>
>
I would like to make sure that my modules do not interfere with d
lang. Is there any way to escape reserved words?
https://dlang.org/spec/lex.html#keywords
import alias;
C:\Users\Juozas\Desktop\om.d(2): Error: identifier expected
following import
C:\Users\Juozas\Desktop\om.d(2): Error: ;
On Wednesday, 19 June 2019 at 12:55:09 UTC, Jonathan M Davis
wrote:
Even in C++, using const ref is not as good a practice as it
once was, because they added move constructors, finally making
object moveable. The result is that in many cases, it's
actually more efficient to just copy values
On Wednesday, June 19, 2019 11:12:14 AM MDT lili via Digitalmars-d-learn
wrote:
> Hi Guys;
> In the dmd source code, has lot of extern (C++), Why need this
> and what is difference between extern(C++) extern(D), Thanks your
> answer.
extern(C++) is for making the name mangling match C++,
On Wednesday, 19 June 2019 at 17:15:31 UTC, Ali Çehreli wrote:
On 06/19/2019 08:28 AM, harfel wrote:
You need to define toHash() member function as well:
https://dlang.org/spec/hash-map.html#using_struct_as_key
Ali
Thanks Ali,
This fixed my problem, of course. Amazing that such a
On Wednesday, 19 June 2019 at 14:58:44 UTC, drug wrote:
19.06.2019 17:52, Den_d_y пишет:
void load (const (char *) path)
{
SDL_Surface ab = SDL_LoadBMP (path);
a = SDL_CreateTextureFromSurface (ab);
SDL_FreeSurface (ab);
}
try the following:
```
void load (string path)
{
On 06/19/2019 08:28 AM, harfel wrote:
Everything works nicely if I compare the structs directly. Yet when they
are used as keys in an associative array, the code throws an exception
that I do not understand.
You need to define toHash() member function as well:
Hi Guys;
In the dmd source code, has lot of extern (C++), Why need this
and what is difference between extern(C++) extern(D), Thanks your
answer.
On Wednesday, 19 June 2019 at 12:53:05 UTC, Cym13 wrote:
Did you import it properly?
```
void main() {
import core.stdcpp.array;
auto a = array!(int, 4)();
}
```
compiles and runs without issue for me. You'll have to show
your code if you want people to help you
I am trying to overload opEquals for a struct. The struct will
hold class objects that define their own opEquals so the default
bitwise comparison is not good for me.
Everything works nicely if I compare the structs directly. Yet
when they are used as keys in an associative array, the code
19.06.2019 17:52, Den_d_y пишет:
void load (const (char *) path)
{
SDL_Surface ab = SDL_LoadBMP (path);
a = SDL_CreateTextureFromSurface (ab);
SDL_FreeSurface (ab);
}
try the following:
```
void load (string path)
{
import std.string : toStringz;
SDL_Surface ab =
Hello, users of this programming language! I have a question. I
use in my application Derelict SDL 2 version 2.1.4.
And when I try to specify the path to the image:
void load (const (char *) path)
{
SDL_Surface ab = SDL_LoadBMP (path);
a = SDL_CreateTextureFromSurface (ab);
On Wednesday, June 19, 2019 6:33:44 AM MDT XavierAP via Digitalmars-d-learn
wrote:
> I often use a pattern of having const ref struct parameters (as
> in C++) but this doesn't work in the case of rvalues. The
> workaround of defining an overload that calls its own name is
> terrible. I understand
On Wednesday, 19 June 2019 at 05:27:12 UTC, lili wrote:
On Tuesday, 18 June 2019 at 17:29:49 UTC, Cym13 wrote:
On Tuesday, 18 June 2019 at 17:25:42 UTC, Cym13 wrote:
On Tuesday, 18 June 2019 at 13:05:03 UTC, lili wrote:
On Tuesday, 18 June 2019 at 12:39:45 UTC, Dennis wrote:
[...]
Thanks a
I often use a pattern of having const ref struct parameters (as
in C++) but this doesn't work in the case of rvalues. The
workaround of defining an overload that calls its own name is
terrible. I understand there was a DIP 1016 by Manu asking for
this case to work. As far as I can tell, this
On Tuesday, 18 June 2019 at 13:19:48 UTC, Ron Tarrant wrote:
And just a quick tip of the hat
Forgot to thank Russell Winder for suggesting Previous/Next
buttons which have also been implemented on all pages. Should
make navigation easier for those multi-part posts.
On Wednesday, 19 June 2019 at 08:29:15 UTC, dangbinghoo wrote:
hi there,
Does anyone know the micro-service oriented design library or
framework in D?
thanks!
binghoo dang
What do you need from such a library?
Some suggestions:
For networking, there is vibe.d[0] which provides both
On Tuesday, 18 June 2019 at 09:17:09 UTC, Bart wrote:
I'm new to component based programming. I've read it is an
alternative to oop for speed.
Component based modelling is part of the OO-modelling toolbox.
Also, it isn't new, e.g. database-oriented modelling techniques
often use the same
On Wednesday, 19 June 2019 at 06:52:33 UTC, IanFisher wrote:
Hi,
I am wanting to establish a virtual serial port connection
between an 89c51 being emulated in Proteus and Hyper Terminal
running in Windows.
How do I go about doing this?
Thanks in advance
Hello.
Look at the reply above
hi there,
Does anyone know the micro-service oriented design library or
framework in D?
thanks!
binghoo dang
Hi,
I am wanting to establish a virtual serial port connection
between an 89c51 being emulated in Proteus and Hyper Terminal
running in Windows.
How do I go about doing this?
Thanks in advance
On Wednesday, 19 June 2019 at 06:00:28 UTC, Jonathan M Davis
wrote:
On Tuesday, June 18, 2019 10:27:46 PM MDT lili via
Do you known reason for why Dlang Range are consumed by
iterating over them. I this design is strange.
If you want an overview of ranges, you can watch this:
On Tuesday, June 18, 2019 10:27:46 PM MDT lili via Digitalmars-d-learn
wrote:
> On Tuesday, 18 June 2019 at 17:25:51 UTC, Johannes Loher wrote:
> > The result of heapify is a BinaryHeap, which is a range. writeln
> > basically prints ranges by iterating over them and printing
> > each element
> >
36 matches
Mail list logo