On Thursday, 5 December 2019 at 00:05:26 UTC, Ola Fosheim Grøstad
wrote:
On Wednesday, 4 December 2019 at 23:27:49 UTC, Steven
Schveighoffer wrote:
void main()
{
foo!a(); // const(int)
foo!b(); // immutable(int)
foo!c(); // const(int)
}
Ok, so one has to use a wrapper and then "cat
On Wednesday, 4 December 2019 at 23:53:53 UTC, NeeO wrote:
Would someone be able to explain this ? I can only seem to call
a template constructor in one way, but I can't seem to pass
what looks like an accepted type to the template constructor
via a function call.
/+ main.d +/
import std.stdi
On Wednesday, 4 December 2019 at 23:27:49 UTC, Steven
Schveighoffer wrote:
void main()
{
foo!a(); // const(int)
foo!b(); // immutable(int)
foo!c(); // const(int)
}
Ok, so one has to use a wrapper and then "catch" the result with
auto?
auto x = foo!f();
Would someone be able to explain this ? I can only seem to call a
template constructor in one way, but I can't seem to pass what
looks like an accepted type to the template constructor via a
function call.
/+ main.d +/
import std.stdio ;
struct obj_ (T) {
int demo ;
this (int R,int C)(
On 12/4/19 5:57 PM, Ola Fosheim Grøstad wrote:
On Wednesday, 4 December 2019 at 22:51:01 UTC, Ola Fosheim Grøstad wrote:
Is there a way to specify in generic code that you want the best fit
of a const/immutable reference depending on the return type (but not a
mutable one)?
I mean, if f() ret
On Wednesday, 4 December 2019 at 22:51:01 UTC, Ola Fosheim
Grøstad wrote:
Is there a way to specify in generic code that you want the
best fit of a const/immutable reference depending on the return
type (but not a mutable one)?
I mean, if f() return mutable or const then it should be const,
b
On 12/4/19 5:04 PM, kerdemdemir wrote:
GC.sizeof(cast(void*)object) will be super useful. I will use that.
I also tried GC: --DRT-gcopt=profile:1 already. It provides so little
information.
I need to find out which member AA or array of which object is causing
this memory problem of mine.I am
On Wednesday, 4 December 2019 at 22:43:35 UTC, Bastiaan Veelo
wrote:
There is a difference I guess if g() returns a reference type
and is an inout function. immutable y will only work if the
reference returned is immutable.
But not for values?
Const is a promise to the rest of the code that y
On Wednesday, 4 December 2019 at 14:44:43 UTC, Ola Fosheim
Grøstad wrote:
When is there a noticable difference when using const values
instead of immutable values in a function body? And when should
immutable be used instead of const?
f(){
const x = g();
immutable y = g();
... do stuff w
On Wednesday, 4 December 2019 at 22:29:13 UTC, kerdemdemir wrote:
Unfortunately I am not yet good with D to answer your question .
But Ali Çehreli made some comparesions with C++.
https://dconf.org/2013/talks/cehreli.pdf
And I think you will find the answers of your questions in it
also.
Thank
On Wednesday, 4 December 2019 at 14:44:43 UTC, Ola Fosheim
Grøstad wrote:
When is there a noticable difference when using const values
instead of immutable values in a function body? And when should
immutable be used instead of const?
f(){
const x = g();
immutable y = g();
... do stuff w
On Wednesday, 4 December 2019 at 15:38:36 UTC, Steven
Schveighoffer wrote:
On 12/4/19 3:10 AM, Erdem wrote:
I am used to have cool tools like valgrid massif to visualize
the memory usage from C++ but in D it seems I am blind folded
looking for the problem.
Until now I tried:
--vgc option whi
On Monday, 2 December 2019 at 02:15:36 UTC, Suleyman wrote:
The command you need is "make -Ctest". Or you can run a
specific test manually using run.d.
```
cd test/
./run.d compilable/traits.d
```
Thanks
On 12/3/19 12:35 PM, Robert M. Münch wrote:
The first three lines are on module level, the second two lines are
inside a class member function.
pragma(msg,WM_MOUSEMOVE_LBUTTON_STREAM.sizeof);
8LU
but
pragma(msg,windows_message_streams[WM_MOUSEMOVE].filter!(win =>
(win.wParam & MK_LBUTTON)
On 2019-12-03 16:34:43 +, Robert M. Münch said:
I have very strange casting error I don't understand:
alias typeof(windows_message_streams[WM_MOUSEMOVE].filter!(win =>
(win.wParam & MK_LBUTTON))) WM_MOUSEMOVE_LBUTTON_TYPE;
WM_MOUSEMOVE_LBUTTON_TYPE WM_MOUSEMOVE_LBUTTON_STREAM;
pragma(msg,
On 12/4/19 3:10 AM, Erdem wrote:
I am used to have cool tools like valgrid massif to visualize the memory
usage from C++ but in D it seems I am blind folded looking for the problem.
Until now I tried:
--vgc option which show million things which makes it not useful
--build=profile-gc
which see
Also, in file scope, would C++:
constexpr auto constant = 3;
be the same as:
immutable constant = 3;
?
When is there a noticable difference when using const values
instead of immutable values in a function body? And when should
immutable be used instead of const?
f(){
const x = g();
immutable y = g();
... do stuff with x and y …
}
I'm comparing D to C++ and I get the following mapping:
D
On Wednesday, 4 December 2019 at 03:17:27 UTC, Adam D. Ruppe
wrote:
On Wednesday, 4 December 2019 at 01:28:00 UTC, H. S. Teoh wrote:
typeof(return) is one of the lesser known cool things about D
that make it so cool. Somebody should write an article about
it to raise awareness of it. :-D
you
On Tuesday, 3 December 2019 at 10:19:02 UTC, Jonathan M Davis
wrote:
On Tuesday, December 3, 2019 3:03:22 AM MST Basile B. via
Digitalmars-d- learn wrote:
On Tuesday, 3 December 2019 at 09:58:36 UTC, Jonathan M Davis
wrote:
> On Tuesday, December 3, 2019 12:12:18 AM MST Basile B. via
>
> Digita
On Tuesday, 3 December 2019 at 23:44:59 UTC, mipri wrote:
On Tuesday, 3 December 2019 at 10:13:30 UTC, mipri wrote:
Speaking of nice stuff and aliases, suppose you want to
return a nice tuple with named elements?
Option 1: auto
auto option1() {
return tuple!(int, "apples", int, "orange
I am used to have cool tools like valgrid massif to visualize the
memory usage from C++ but in D it seems I am blind folded looking
for the problem.
Until now I tried:
--vgc option which show million things which makes it not useful
--build=profile-gc
which seems to slow down my program like *
On Tuesday, 3 December 2019 at 13:43:26 UTC, Jan Hönig wrote:
pseudocode:
alias set = bool[]
set foo = ...
set bar = ...
set result;
One simple optimization is to
set* smallest;
set* largest;
if (foo.length < bar.length)
{
smallest = &foo;
largest = &bar;
}
else
{
smallest = &bar;
23 matches
Mail list logo