On 5/7/20 8:33 AM, Ben Jones wrote:> I was doing some metaprogramming
where I wanted to make a slice of a type:
[...]
> alias Ts = AliasSeq!int;
> pragma(msg, Ts);
> alias Tsa = Ts[];
> pragma(msg, Tsa);
> //prints (int), (int)
>
> which confused me until I realized that the [] was slicing the
On 5/5/20 8:41 PM, data pulverizer wrote:> On Wednesday, 6 May 2020 at
03:33:12 UTC, Mathias LANG wrote:
>> On Wednesday, 6 May 2020 at 03:25:41 UTC, data pulverizer wrote:
> Is there something I need to do to wait for each thread to finish
> computation?
thread_joinAll(). I have an example her
On 5/4/20 2:47 AM, Olivier Pisano wrote:
On Monday, 4 May 2020 at 09:20:06 UTC, Ali Çehreli wrote:
On 4/30/20 10:04 AM, Ben Jones wrote:> On Thursday, 30 April 2020 at
16:55:36 UTC, Robert M. Münch wrote:
> I think you want to use scope rather than auto which will put
the class
> on the stack
On 4/30/20 10:04 AM, Ben Jones wrote:> On Thursday, 30 April 2020 at
16:55:36 UTC, Robert M. Münch wrote:
> I think you want to use scope rather than auto which will put the class
> on the stack and call its destructor:
> https://dlang.org/spec/attribute.html#scope
That is correct about calling
On 5/3/20 2:59 PM, Harry Gillanders wrote:> On Sunday, 3 May 2020 at
12:19:30 UTC, Robert M. Münch wrote:
> an `auto ref` parameter[1] in a
> function template is essentially a parameter that receives the
> argument by reference if the templated type is a value-type,
Please replace "a value-typ
On 5/3/20 1:44 PM, Marcone wrote:
On Sunday, 3 May 2020 at 20:11:58 UTC, Adam D. Ruppe wrote:
On Sunday, 3 May 2020 at 20:02:09 UTC, Marcone wrote:
How can I check if an element is iterable in Dlang?
http://dpldocs.info/experimental-docs/std.traits.isIterable.html
I don't want to check if t
On 5/3/20 4:03 PM, Marcone wrote:
In C++ I just use -fpermissive
foreach(i; tuple(10, "lemon", false, "John", 1.6, 'c'))
{
writeln(i);
if(i == "John") break; // Error
}
I am not sure I understand your question because it already omits an
error. If you're asking how to get th
On 5/1/20 7:40 PM, dan wrote:> On Saturday, 2 May 2020 at 02:29:43 UTC,
H. S. Teoh wrote:
>> On Sat, May 02, 2020 at 02:22:42AM +, dan via Digitalmars-d-learn
>> wrote:
>>> I'm looking for a function something like writeln or write, but
>>> instead of writing to stdout, it writes to a string
On 4/28/20 1:48 PM, Net wrote:
> () { ... } ();
>
> Is there a name of this kind of function in D? unnamed? anonymous?
Lambda or anonymous function.[1]
Note that the last () is not part of the definition but the execution of
the function.
This idiom is used for initializing e.g. a const varia
On 4/24/20 2:11 PM, Steven Schveighoffer wrote:> On 4/24/20 4:24 PM,
matheus wrote:
> whomever controlled the sociomantic youtube account took down
> all the videos.
I think it's unintentional because the same thing happened to my Weka
account: After I stopped working there, the company natura
On 4/4/20 8:45 AM, Steven Schveighoffer wrote:
>> Yes, sure, but in C++ I don't have to explicitly write this down. It
>> just works. IMO that makes a lot of sense as long as all types fit.
>> This just looks superfluously.
>>
>
> steves@homebuild:~$ cat test.cpp
> struct S
> {
> float a;
>
On 3/6/20 5:59 AM, Marcone wrote:> On Friday, 6 March 2020 at 05:31:57
UTC, Mathias Lang wrote:
> I'm coming from Python
The fact that errors are delayed until run time is a Python deficiency.
We accept that deficiency because we also accept claimed benefits that
Python brings.
If you want
On 2/29/20 11:38 AM, JN wrote:
> assert(1 in [1, 2, 3]);
Because you mentioned canFind, I think you want the semantics to be "is
there an element with this value." If so, it would be confusing to use
the same operator for two different things: For associative arrays, it
means "is there an ele
On 2/25/20 3:02 AM, wjoe wrote:> Lets say I've got 3 overloads of
opIndexAssign:
>
> auto opIndexAssign(T t);
> an internet search which didn't find any useful
> information.
I have examples for non-templatized and templatized versions of
opIndexAssign here:
http://ddili.org/ders/d.en/opera
On 2/22/20 2:29 PM, Robert M. Münch wrote:
I don't get how I can create a dynamic array of Cycle buffers of size 2
which use a struct.
struct ms {
int a;
int b;
}
ms[2] msBuffer;
alias circularStructBuffersT = typeof(cycle(msBuffer));
circularStructBuffersT[int] circularStruct
On 2/21/20 12:51 AM, Andre Pany wrote:
Hi,
I have a 2D double array and I want to subtract from the first column a
value,
is this possible with matrix operation in D?
```
void main()
{
double[][] data = [[0.0, 1.4], [1.0, 5.2], [2.0, 0.8]];
// subtract -2.0 from the first column fo
On 2/20/20 4:46 PM, Ali Çehreli wrote:
>auto range = std.regex.splitter!(No.keepSeparators)(l,
> ctRegex!`[\s-\)\(\.]+`);
After realizing that No.keepSeparators is the default value anyway, I
tried 'split' and it worked the way you wanted. So, perhaps all you
needed was that extra '+' in t
On 2/20/20 2:02 PM, AlphaPurned wrote:> std.regex.split(l,
ctRegex!`[\s-\)\(\.]`);
>
> I'm trying too split a string on spaces and stuff... but it is returning
> empty strings and other matches(e.g., ()).
>
> I realize I can delete afterwards but is there a direct way from split
> or ctRegex?
It
On 2/17/20 8:41 AM, cc wrote:
Is there any way to see the compilation errors that occurred within an
opDispatch template?
struct Foo {
void opDispatch(string s, SA...)(SA sargs) {
literally anything;
}
}
Foo foo;
foo.hello(5);
Result: Error: no property `hello` for type `Fo
On 2/8/20 12:22 AM, Adnan wrote:
Just a foreword, this is for learning purposes, hence I am not using the
dynamic array or Array!T.
I have a structure that maintains a heap allocated sized array inside.
struct LifoStack(T) {
T[?] data;
}
This `data` is manually resized and copied. Thus the
On 2/5/20 8:49 AM, Claudiu wrote:
In class "Min" definition I am receiving this error: "cannot implicitly
override base class method `IncrementalStat.accumulate` with
`Min.accumulate`; add `override` attribute"
Andrei's book is a little dated. Here is the errata:
http://erdani.com/index.p
On 1/30/20 4:51 PM, Ben Jones wrote:
The following result doesn't make sense to me... how does isInstanceOf
return false?
```
import std.traits;
import std.stdio;
import std.typecons;
auto f(T)(T t){
return Nullable!T(t);
}
void main(){
auto f3 = f(3);
writeln(typeof(f3).stringof
On 1/28/20 1:55 AM, Herbert wrote:
> wow, pragma,
pragma was to indicate the type of elements at compile time.
> import ...
Yes, iota is a Phobos feature, part of a module.
> only to declare a subrange type, something so simple and natural
Some languages think so.
> I could use it in many f
On 1/27/20 1:15 PM, Herbert wrote:
On Monday, 27 January 2020 at 20:15:33 UTC, Steven Schveighoffer wrote:
On 1/27/20 3:06 PM, Herbert wrote:
How can I create a subrange type, for example ushort DiceValue {1 ...
6}?
D doesn't have a "Range" type like this. But you can use ranges of
different
On 1/17/20 7:53 PM, Adam D. Ruppe wrote:
Did you already try rt_init? That should trigger it
I was under the impression that the extern (C) function rt_init() would
magically be exposed from the library but 'nm' showed no such symbol.
So, I ended up exposing a my_init() function, which ca
On 1/18/20 6:14 AM, Guillaume Piolat wrote:
On Saturday, 18 January 2020 at 03:53:43 UTC, Adam D. Ruppe wrote:
Did you already try rt_init? That should trigger it
Indeed, this is done by runtime initialization.
Thank you, Adam and Guillaume. That tells me I've been using druntime
withou
Simply linking my D shared library with foreign code (Python with the
help of ctypes in this case) does not work. What function should I call?
What about 'shared static ~this()'? And would the answer be different
for 'static this()' etc.?
Thank you,
Ali
On 1/17/20 3:04 PM, Petar Kirov [ZombineDev] wrote:> On Friday, 17
January 2020 at 21:40:05 UTC, JN wrote:
> I think the problem comes from the way you compile and link your code. I
> you compile both modules together like this it should work out:
>
> dmd -ofresult main.d stuff.d
If that's the
On 1/14/20 8:15 PM, Alex Burton wrote:> On Thursday, 9 January 2020 at
10:26:07 UTC, Jonathan M Davis wrote:
>> On Wednesday, January 8, 2020 10:56:20 PM MST rikki cattermole via
>> Digitalmars-d-learn wrote:
>>> Slicing via the opSlice operator overload is a convention, not a
>>> requirement.
>>
On 1/13/20 2:28 AM, mark wrote:
I'm just starting out learning D.
Andrei Alexandrescu's "The D Programming Language" is 10 years old, so
is it still worth getting? (I don't know how much D has changed in 10
years.)
Yes, Andrei's book is dated but it offers a great perspective on D and
pro
On 1/3/20 11:51 PM, MGW wrote:
Need help:
There' s a large text file (hundreds of thousands of lines).
How long are the lines? If 1K bytes, 100M would fit in memory just fine.
There is a parallel quick sort example on the std.parallelism page:
https://dlang.org/phobos/std_parallelism.html
On 11/26/19 2:08 PM, Taylor R Hillegeist wrote:> On Tuesday, 26 November
2019 at 16:33:06 UTC, Timon Gehr wrote:
>> int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;
>
>
> how did you know to do that?
Ranges don't have elements. They either generate elements according to
an algorithm, prov
On 11/21/19 9:10 PM, Mike Parker wrote:> On Friday, 22 November 2019 at
04:45:21 UTC, Mike Parker wrote:
> You need to call readf with a character
> format string (%c):
>
> import std.stdio;
> void main()
> {
> writeln("Press any key to continue...");
>
> char c;
> readf("%c", &c)
On 11/18/19 7:16 AM, Yui Hosaka wrote:
gives the output 950, while it should be 100.
Looks like a bug. Confirmed with dmd 2.088.0 compiling with -O -m32 on
Ubuntu.
Ali
One correction: I think you mean "using" a default-initialized array is
faster (not the initialization itself).
Another observation: dmd -O makes both cases slower! Hm?
Ali
On 11/07/2019 07:07 AM, bioinfornatics wrote:
> Dear,
>
> I try to use the async buffer describe into std.parallelism
> documentation but my test code core dump!
I admit I don't fully understand the lifetime issues but removing the
"code smell" of the modul-level File object solved the issue for
On 11/07/2019 04:14 AM, Luh wrote:
> Hey there,
>
> I figured out some strange behavior ;
>
> #1
> It seems that the linker doesn't check for the function declared twice
> first.
It's not the linker but the "compiler" that is concerned about these things.
> Instead, it says:
>
> "Error: class ap
On 11/03/2019 08:55 AM, Vinod K Chandran wrote:
> Hi all,
> I can do this in C++.
> #include
> using namespace std ;
>
> #define end };
> #define log(x) cout << x << endl
> #define wait std::cin.get()
There is nothing that stops one from using the C++ preprocessor on any
text file. For example
On 11/01/2019 09:33 AM, Paul Backus wrote:
> On Friday, 1 November 2019 at 15:29:24 UTC, Ali Çehreli wrote:
>> Apparently, it's the version for static arrays. However, I don't think
>> the template constraint is doing anything there because if T matches a
>> static array (of the form U[n]), then
On 11/01/2019 04:09 AM, berni44 wrote:
> What I don't understand is the 4th version with two extra parameters.
> Here the documentation lacks an explanation, what this is good for.
I went to the documentation by clicking "View source code" and scrolled
a bit and found this:
https://github.c
On 10/28/2019 03:20 PM, IGotD- wrote:
I'm trying to find if D has any built in special integer operations like
bit reverse, population count, count leading zeroes, count trailing
zeroes.
https://dlang.org/phobos/core_bitop.html
Ali
On 10/25/2019 02:25 AM, Dennis wrote:
> On Friday, 25 October 2019 at 05:17:35 UTC, Ali Çehreli wrote:
>> - Big O is different
>
> No it isn't.
Agreed and I've just realized a benefit of the 'in' operator for arrays,
which I haven't heard before. (I don't follow all discussions in
detail.) 'in'
On 10/25/2019 05:37 AM, Stefan Koch wrote:
just replace x = a[i] with x = a.ptr[i];
That's a neat trick!
Ali
On 10/25/2019 07:34 AM, Robert M. Münch wrote:
> If the compiler is a 1-pass one I see the problem, otherwise one could
> first get a "total overview" and create the necessary vtbl entries after
> everything is known. Maybe this is not "how a compiler is implemented"
> but the problem sounds solv
On 10/24/2019 05:58 AM, lili wrote:
> Hi:
> In Dlang where is strange design. The in expression can only use to
> associative array, why array can not use in expression.
In addition to the big O surprise, there is another important issue that
may be seen as either for or against supporting t
On 10/24/2019 10:57 AM, Robert M. Münch wrote:
> Unfortunately, member function template instances are never virtual
> functions, so you can't override them."
>
> Is there a reason why these type of functions are not virtual or can't
> be made virtual?
One practical reason is, the number of thei
On 10/24/2019 10:21 AM, Ali Çehreli wrote:
auto lines = File(fileName, "r").byLineCopy(No.keepTerminator, '\r');
auto result = lines.joiner("-").text;
I would normally do the following
auto lines = File(fileName, "r").byLineCopy(No.keepTerminator, '\r');
auto result = format!"%-(%s-%
On 10/24/2019 09:49 AM, Mil58 wrote:
On Thursday, 24 October 2019 at 16:21:47 UTC, welkam wrote:
On Thursday, 24 October 2019 at 15:27:05 UTC, Mil58 wrote:
[...]
void main() {
File("data.txt", "r+")
.byLineCopy()
.array()
.each!writeln;
}
byLineCopy removes the ne
On 10/23/2019 02:43 AM, Robert M. Münch wrote:
>> Unfortunately, member function template instances are never virtual
>> functions, so you can't override them.
>
> What I don't understand is:
>
> 1. The RX lib has a member function template and than an instance of it
> using type Oberver!E.
>
> 2
On 10/22/2019 01:23 PM, Robert M. Münch wrote:
> The whole code
> can be found here: https://pastebin.com/5BTT16Ze
That says "private paste" for me. But I think you have a member function
template in the base class. Unfortunately, member function template
instances are never virtual functions,
On 10/22/2019 11:25 AM, Vinod K Chandran wrote:
> On Tuesday, 22 October 2019 at 17:38:58 UTC, Adam D. Ruppe wrote:
>> On Tuesday, 22 October 2019 at 17:34:51 UTC, Vinod K Chandran wrote:
>>> Hi all,
>>> I am new to D. But some fair experience with vb.net. I was playing
>>> with D classes. I wrot
On 10/16/2019 02:34 PM, Dennis wrote:
> Except that e.g. -2 - int.max underflows to int.max suggesting that
> int.max < -2.
Timon had corrected me on that point a while back, so I had added the
following warning at
http://ddili.org/ders/d.en/operator_overloading.html#ix_operator_overloading.
On 10/10/2019 05:41 PM, Murilo wrote:
> I have started working with neural networks and for that I need a lot of
> computing power but the programs I make only use around 30% of the cpu,
> or at least that is what Task Manager tells me. How can I make it use
> all 4 cores of my AMD FX-4300 and how
On 10/07/2019 10:11 AM, Just Dave wrote:
I need a stack and a queue
There is a DoubleEndedQueue example under "Indexing Operators" here:
http://ddili.org/ders/d.en/operator_overloading.html#ix_operator_overloading.opIndexOpAssign
It does not have the pop varieties but it should be trivial to
On 09/25/2019 12:06 PM, WhatMeWorry wrote:
> I was
> assuming that [] meant "the entirety" of the array.
Assuming we're talking about D slices, Yes. (It could be a user-defined
type with surprisingly different semantics.)
> In short, is there anytime that one would want to use "slice[] =
> so
On 09/23/2019 01:45 PM, Ron Tarrant wrote:
> Well, it turns out, I didn't need a linked list, doubly or otherwise.
So, what was it then? Append to an array, sort it, and be happy? :)
Ali
On 09/20/2019 12:02 PM, JN wrote:
> import std.stdio;
>
> interface IWriter
> {
> void write(U)(U x);
> }
>
> class Foo : IWriter
> {
> void write(U)(U x, int y)
> {
> writeln(x);
> }
> }
>
>
>
> void main()
> {
> }
>
> Does this code make sense?
No. Function template
tl;dr Instead of returning an object that uses local state, return an
object that uses member variables.
We've discovered one such allocation inside std.format.sformat today
during our local meetup[1], started fixing it, and discovered that it
has already been fixed by ag0aep6g just 19 days ag
On 09/20/2019 01:58 AM, oleobal wrote:
> My understanding is D has no dynamic dispatch,
That's too general. :) D has dynamic dispatch through virtual functions.
I don't understand everything here but I think the 'typeid' expression
and the 'TypeInfo' class hierarnhy that it returns can be usef
On 09/12/2019 02:54 AM, Ron Tarrant wrote:
> I thought it was odd having 'q' in front of the opening curly brace...
I think my index can be useful in such searches. Both q"" and q{} are there:
http://ddili.org/ders/d.en/ix.html
Ali
On 09/11/2019 01:35 AM, berni wrote:
I'd like to write a template, that takes a different default value
depending on the type of a variable.
Like this?
import std.stdio;
void main()
{
double a = 1e-8;
double b = 1e-10;
float c = 1e-4;
float d = 1e-6;
assert(!test(a));
assert(test
On 09/10/2019 03:32 AM, Andre Pany wrote:
> @Foo void method0(){}
>
> @Foo("abc") void method1(){}
The UDA syntax allows both types and an objects. method0 uses Foo type
and method1 uses a Foo object. So, if your API allows both, your code
that deals with UDA must account for both.
On 09/09/2019 01:59 PM, Ali Çehreli wrote:
> On 09/09/2019 12:08 PM, WhatMeWorry wrote:
> > Is this even possible?
>
> No because there can't be expressions at module scope.
Attempting to correct myself: I think only declarations are allowed at
module scope. Non-compile-time statements like for
On 09/09/2019 12:08 PM, WhatMeWorry wrote:
> Is this even possible?
No because there can't be expressions at module scope.
> static if(true)
> {
> int r = 2;
> int c = 40;
Those are fine.
> static foreach(i ; foundations)
> {
> immutable string brackets = "\033[" ~
On 09/07/2019 03:26 AM, Andrew Edwards wrote:
> [1] I did not declare any of the other member variables from the struct,
> don't know if this is a source of the problem.
Yes, it definitely is a problem. The members are accessed as byte
offsets into their objects. Without defining the other memb
On 09/07/2019 03:26 AM, Andrew Edwards wrote:
> float continuallyUpdatedValue;
> float continuallyChangingValue; // [1]
They mean the same thing for an English speaker but compilers don't know
that (yet?). :)
Ali
On 09/06/2019 01:46 PM, Bob4 wrote:
> Thanks; this works, but I'm not sure why. Where does `T` come from?
Well... I assumed this would make you research templates. ;) Here is one
resource: http://ddili.org/ders/d.en/templates.html
(T) means "this function is for any type; and I call that type
On 09/06/2019 01:02 PM, Bob4 wrote:
> I feel like it's wrong to rewrite identical functions over and over.
Enter templates. :)
auto clamp(T)(T value, T mini, T maxi) {
if (value >= maxi) {
return maxi;
}
if (value <= mini) {
return mini;
}
return value;
}
unittest {
assert(
On 09/06/2019 02:14 AM, Andrew Edwards wrote:
> I'm seeking some pointers on how to define these in D
Here is my attempt:
struct Demo {
// NOTE: The types and number of elements can be templatized and
mixed-in like
// mixin (makeMembers!T(N));
float a = 0;
float b = 0;
float c = 0;
On 09/05/2019 12:51 PM, berni wrote:
>> int[int] a;
>>
>> immutable int b = 17;
>> a[1] = b; // <-- expecting error here
As explained elsewhere, a[1] is a mutable int. That assignment is
copying b on top of the element.
>> const oldPointer = (1 in a);
On 09/05/2019 07:31 AM, berni wrote:
> On Thursday, 5 September 2019 at 13:27:55 UTC, drug wrote:
>> [...]when you put it into an AA you modify old value
>
> Why?!? :-o When putting it into an AA it will be copied to a different
> place in memory,
That's the misunderstanding: The existing object
On 08/27/2019 10:17 PM, Jabari Zakiya wrote:
> I can't do (a, b, c,d) = func1(i) directly.
> What do I do to assign the output of func1 to the individual variables?
I had some time to play with the following syntax, similar usage of
which has been proposed a number of times as a replacement for
On 08/16/2019 02:07 PM, Andrey Zherikov wrote:
But:
- if I change line (1) to `auto args = ["app", "--foo", "foo", "--bar",
"bar"];` then this code works.
- if I remove line (2) then this code works.
Yes, it's a bug.
Another workaround--which I haven't tested to see whether produces the
be
On 08/13/2019 03:12 PM, Mirjam Akkersdijk wrote:
> For the application I am writing, it makes very much sense to use a DLL.
Yes, Dynamically Linked Libraries can be useful. Oh wait... You mean
Doubly-Linked List. :o)
> I tried setting the length first and iterating through it with `nodes[i]
>
On 08/13/2019 10:33 AM, Mirjam Akkersdijk wrote:
> On Tuesday, 13 August 2019 at 14:04:45 UTC, Sebastiaan Koppe wrote:
>> Convert the nodes into an D array, sort the array with nodes.sort!"a.x
>> < b.x" and then iterate the array and repair the next/prev pointers.
If possible, I would go further
On 08/11/2019 09:43 AM, DanielG wrote:
such a simple
error
You're not alone. We want this bug fixed:
https://issues.dlang.org/show_bug.cgi?id=17263
Ali
On 08/04/2019 11:12 AM, matheus wrote:
Hi,
The snippet below will produce an "infinite loop" because obviously
"ubyte u" will overflow after 255:
import std.stdio;
void main(){
ubyte u = 250;
for(;u<256;++u){
writeln(u);
}
}
Question: Is there a way (Flag) to prevent
On 07/30/2019 02:33 AM, Ron Tarrant wrote:
> With contemporary search engines, it's impossible to search for '!' and
> get meaningful results.
I recommend this Index section for such cases:
http://ddili.org/ders/d.en/ix.html
Like most of Phobos, Scoped is not there but the "!, template insta
On 07/31/2019 10:29 AM, Andrey Zherikov wrote:
I want my program to add some directories into module lookup process
(like adding -I dmd options). List of directories is known at compile
time but the choice of what exact directories to add depends on
`-version` parameter.
Is there a way to achi
On 07/31/2019 01:03 PM, NonNull wrote:
I am creating a specialized bit pattern (secretly represented as a uint)
as a struct S, but want to avoid `alias this` to maintain encapsulation
excepting where I overtly say. Specifically, I want to avoid making
arithmetic and inequalities available for S
n 07/31/2019 12:05 PM, Paul Backus wrote:
> I would not recommend D as a beginning language, both because there are
> fewer beginner-oriented resources available for it than for C and Python
> (the only one I know of is Ali Çehreli's book [1]), and because it's a
> bigger, more complicated langua
On 07/28/2019 05:56 AM, BoQsc wrote:
Right now, I'm thinking what is correct way to run another .d script
from a .d script. Do you have any suggestions?
I can be easier than a shared library solution that Max Haughton
described. (None of the following code are compiled.)
If you have the foll
On 07/25/2019 05:46 AM, Oleg B wrote:
On Thursday, 25 July 2019 at 12:34:15 UTC, rikki cattermole wrote:
Those restrictions don't stop at runtime.
It's vary sad.
What reason for such restrictions? It's fundamental idea or temporary
implementation?
It looks like a bug to me.
Ali
On 07/24/2019 05:35 PM, Ben Ogles wrote:
> Is there a way to use a C header that contains a struct declaration but
> no definition?
>
> For example, the C header may contain:
>
> typedef struct some_type_s some_type;
>
> Which is only fully defined in the implementing C file:
>
> struct some_type_
On 07/22/2019 08:48 PM, Timon Gehr wrote:
> This is probably not your problem, but it may be good to know anyway: D
> allows compilers to perform arbitrary "enhancement" of floating-point
> precision for parts of the computation, including those performed at
> compile time. I think this is stupid
On 07/02/2019 02:27 AM, A. Bressan wrote:
> contrary to C++, lowerBound and
> upperBound give the same piece of information because they return
> complementary sub-ranges.
I don't understand the specific problem but can 'trisect' be useful?
https://dlang.org/library/std/range/sorted_range.tri
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:
https://dlang.org/spec/hash-m
On 05/02/2019 08:21 PM, James Blachly wrote:
On 5/2/19 4:05 PM, ag0aep6g wrote:
Just slice the pointer with the length:
int* ptr;
size_t len;
int[] arr = ptr[0 .. len];
Perfect thanks. I searched but without using the magic word "slice" I
couldn't find meaningful results.
Th
On 04/22/2019 03:29 PM, Andre Pany wrote:
> I wonder wheter std.stdio is missing a readfln function. Which executes
> readln, strips the #10#13 characters and then executes formattedRead.
> Does that make sense to you?
Makes sense but what we are missing is standard streaming (like C++'s
overlo
On 04/22/2019 01:45 PM, Andre Pany wrote:
Hi,
following the example from http://ddili.org/ders/d.en/input.html,
I try to read a value from console on windows (powershell and dos console).
The code from the example does not work,
writeln is never executed.
import std;
void main()
{
while(
On 04/17/2019 05:21 PM, Stefanos Baziotis wrote:
> On Wednesday, 17 April 2019 at 23:44:42 UTC, Adam D. Ruppe wrote:
>>explicit Test(const char* foo) {} // this opts out of the cool
>> thing above
> Actually, I asked initially because in C++ you can do the thing I
> described.
> I thought th
On 04/14/2019 11:03 AM, Robert M. Münch wrote:
struct IM;
struct C {
IM *impl;
};
int cInit(C* self);
class I {
C handler;
this(){cInit(&handler);}
}
Is there a simple way that I can use handler without the address-of
operator and automatically get *impl?
Something like:
class
On 04/14/2019 10:06 PM, LeqxLeqx wrote:
Hello!
I have a question regarding attempting to access the super class of a
derived class at compile time.
BaseClassesTuple and friends:
https://dlang.org/phobos/std_traits.html
Ali
On 04/10/2019 05:07 AM, Ron Tarrant wrote:
>> the book's index:
>>
>> http://ddili.org/ders/d.en/ix.html
> Oops!
Not at all. One of the most useful parts of the book has been the index
section for me. I occasionally search in there... like just yesterday
for the positional format specifier
On 04/08/2019 05:59 AM, Ron Tarrant wrote:
On Monday, 8 April 2019 at 12:40:10 UTC, Adam D. Ruppe wrote:
You don't need template keyword for the majority of cases because the
compiler lets you do shortcuts.
Thanks, Adam. Good to know.
(maybe I am looking at the wrong part of the book, it is
On 04/08/2019 05:23 AM, Ron Tarrant wrote:
> But in "Programming in D," (self, 2009-2018) by Ali Çehreli, there's no
> mention of the 'template' keyword in any of his examples.
'template' keyword is introduced here:
http://ddili.org/ders/d.en/templates_more.html#ix_templates_more.template
I
On 04/08/2019 12:56 PM, Yuxuan Shui wrote:
In this example:
const(AliasSeq!(int, int)) a;
I would expect that to mean a type list (int, int) that cannot be
modified, meaning that it is not allowed to change it from (int, int).
pragma(msg, typeof(a)); // (int, int)
Makes sense
On 04/07/2019 08:41 AM, Robert M. Münch wrote:
> I have an AA int[ulong] and would like to traverse the AA from biggest
> to smallest by value. Is there an elegant way to do this?
Because associative array is a data structure to use when the order is
not important, it comes down to getting the v
On 03/22/2019 12:34 PM, tchaloupka wrote:
> I've searched a lot at it should be working at least on linux, but
> apparently is not or I'm doing something totally wrong..
>
> Our use case is to call shared D library from C# (.Net Core) and from
> different threads.
We needed to do the same from Ja
On 03/19/2019 12:00 AM, Roman Sztergbaum wrote:
On Tuesday, 19 March 2019 at 00:07:44 UTC, Ali Çehreli wrote:
On 03/18/2019 11:54 AM, Roman Sztergbaum wrote:
> [...]
with the
> [...]
Andre Pany has already explained. Otherwise, I was going to say
"collectException can collect Exceptions, not e
901 - 1000 of 2571 matches
Mail list logo