On Tuesday, 18 May 2021 at 10:14:26 UTC, PinDPlugga wrote:
But what I do not understand is why opEquals is necessary and
where in the implementation of toHash it plays its role? Since
area1 and area2 have different static arrays of Points I
understand why `typeid(points).getHash()` would
On Monday, 10 May 2021 at 10:37:51 UTC, Alain De Vos wrote:
Can I say that the compiler is intelligent enough to add the
attributes "pure nothrow @nogc @safe" ?
Yes, in those cases (and some others). The functionality is
described here:
On Friday, 23 April 2021 at 16:53:03 UTC, Iain Buclaw wrote:
*This* **reminds** ~~me~~ __that__ I'm yet to give markdown a
try from my own mail client.
It seems you're missing a header. From Steve's post:
Content-Type: text/plain; charset=utf-8; format=flowed;
delsp=no; markup=markdown
--
On Tuesday, 20 April 2021 at 18:57:46 UTC, ichneumwn wrote:
So my questions:
- is there a module-crossing equivalent of "version"?
mw covered this. There's more documentation here:
https://dlang.org/spec/version.html#version
https://dlang.org/dmd-windows.html#switch-version
- if not, is
On Friday, 26 March 2021 at 14:27:58 UTC, Jack wrote:
On Friday, 26 March 2021 at 06:45:39 UTC, Daniel Kozak wrote:
On Fri, Mar 26, 2021 at 7:36 AM Daniel Kozak
wrote:
On Fri, Mar 26, 2021 at 7:31 AM Daniel Kozak
wrote:
On Fri, Mar 26, 2021 at 6:50 AM Jack via Digitalmars-d-learn
<
On Thursday, 4 March 2021 at 13:58:48 UTC, frankp wrote:
Hi all,
I want to make an opaque type that simply contains an integer
with some immutable constants and toString pretty printing.
Like this:
struct Foo_t
{
private long foo;
alias foo this;
static immutable long Inf =
On Saturday, 20 February 2021 at 09:16:46 UTC, Simon van Bernem
wrote:
I have the following struct declaration:
struct Hash_Table(Key, Value, u32 delegate(ref Key)
custom_hash_function = null)
[snip]
I take it from the error that the problem is not actually the
delegate that I am passing,
On Friday, 19 February 2021 at 10:02:05 UTC, Siemargl wrote:
On Friday, 19 February 2021 at 08:29:36 UTC, Ferhat Kurtulmuş
wrote:
Since classes are reference types all instances of files will
be the same reference of "new File()", which you probably
don't want.
Is any differences between x
On Wednesday, 11 November 2020 at 10:17:09 UTC, zack wrote:
I am new to D. Appending to an array can lead to reallocation,
that's clear. But why is the "reference" b not changed
accordingly to the new position and still points to "old"
memory? Why is b not also changed when reallocating array
On Thursday, 5 November 2020 at 22:48:38 UTC, Marcone wrote:
How add class or struct member after construction? Is it
possible in D? How?
This depends a lot on what you mean. The short answer is no - you
cannot. However, given some limitations, it is possible. What
sort of members do you
On Monday, 26 October 2020 at 11:14:47 UTC, frame wrote:
Did not find this topic:
I have an interface and some wrapper classes that use it. The
wrapper's methods should accept variadic arguments. The runtime
should only work with the interface, trying casting to a
wrapper is not an option,
On Friday, 16 October 2020 at 08:12:59 UTC, Andrey wrote:
Hi,
I have got:
struct Qaz
{
wstring read() {return null;}
wstring hear() {return "";} }
void main()
{
// ...
static if(some_condition) alias method = Qaz.hear;
else alias method = Qaz.read;
// ...
Qaz
On Wednesday, 23 September 2020 at 04:15:51 UTC, mw wrote:
It's there because there _are_ times when it makes sense and
is useful, but it's definitely not safe, so you have to be
careful and know what you're doing.
What do you mean by saying "it's definitely not safe" here?
I mean: if I'm
On Tuesday, 22 September 2020 at 13:19:10 UTC, Daniel Kozak wrote:
So final private functions can be overriden? It seems not, but
the sentence is definitely confusing if not just plain wrong.
Yeah. I've seen this called hiding, shadowing and overwriting
earlier, but never overriding - that's
On Friday, 18 September 2020 at 14:14:31 UTC, Andrey Zherikov
wrote:
It seems that dtor is called at exit from lazy delegate, not at
exit form create():
==
create()
.do_something()
.do_lazy()
.do_something();
==
Output:
==
-> void test.main()
-> test.do_lazy(lazy S
On Friday, 18 September 2020 at 12:32:49 UTC, Andrey Zherikov
wrote:
==
The output is:
==
-> void test.main()
-> test.do_lazy(lazy S s)
-> test.create()
1 S test.S.this(int n)
<- test.create()
1 void test.S.~this()
===-1 (2)
<- test.do_lazy(lazy S s)
-> 1703096
On Friday, 18 September 2020 at 10:43:47 UTC, Andrey Zherikov
wrote:
Why is dtor called before returning from do_lazy function - see
(1)? It seems cause uninitialized parameter in do_something
call after it in (2)-(3).
As ikod mentions, it's because of scoped!S. As for why it does
this,
On Friday, 18 September 2020 at 05:43:56 UTC, data pulverizer
wrote:
I’d like to know if constructors of classes and structs can
have type inference. So far, I am using a separate function for
this purpose, for example:
```
import std.stdio: writeln;
struct Pair(T, U)
{
T first;
U
On Thursday, 17 September 2020 at 21:05:59 UTC, 60rntogo wrote:
struct V
{
int x;
mixin assign!"+";
// mixin assign!"-";
}
However, if I uncomment the second mixin, there is an error "v
is not a scalar, it is a V". I guess I somehow need to merge
these overloads, but I don't know how.
On Thursday, 17 September 2020 at 10:56:28 UTC, Mike Parker wrote:
On Thursday, 17 September 2020 at 09:44:20 UTC, claptrap wrote:
Seriously how it's implemented is irrelevant.
And to be clear, my point wasn't about how it's implemented. My
point was that:
enum { foo = 10; }
and
enum
On Wednesday, 16 September 2020 at 19:04:24 UTC, Vladimirs
Nordholm wrote:
On Wednesday, 16 September 2020 at 18:54:45 UTC, Jacob Carlborg
wrote:
version (Windows)
enum windows = true;
else
enum windows = false;
static if (!windows)
{
// ... my code
}
Ah, I guess it boils down to
On Wednesday, 16 September 2020 at 09:59:59 UTC, Jan Hönig wrote:
I have toyed with the compose template in std.functional and
ran into some problems.
rikki_cattermole on discord helped me a lot to solve my problem.
However, what still remains (for me) to understand is why.
Source code for
On Monday, 14 September 2020 at 03:48:51 UTC, Steven
Schveighoffer wrote:
Consider the enum:
enum Foo { a, b }
Foo.a.stringof => "a"
enum x = Foo.a;
x.stringof => "cast(Foo)0"
Is there another way I can take an enum value that's known at
compile time (but not the actual identifier), and get
On Sunday, 6 September 2020 at 09:58:54 UTC, Johann Lermer wrote:
pointer. The error message says:
std.concurrency.MessageMismatch@std/concurrency.d(237):
Unexpected message type: expected 'shared(Env*)', got
'shared(test.Env)*'
The error message gives you all the information you need -
On Friday, 4 September 2020 at 10:16:47 UTC, 60rntogo wrote:
Consider the following code.
foo.d
---
module foo;
struct Foo
{
private int i;
}
---
main.d
---
void main()
{
import std.stdio;
import foo;
auto x = Foo();
writeln(x);
// ++x.i;
++x.tupleof[0];
writeln(x);
}
---
As
On Tuesday, 1 September 2020 at 02:08:54 UTC, JG wrote:
Is there anyway to remove the boilerplate code of dealing with
tuples:
I find myself having to write things like this fairly often
auto someRandomName = f(...); //where f returns a tuple with
two parts
auto firstPart =
On Friday, 28 August 2020 at 13:35:43 UTC, Alexandru Ermicioi
wrote:
On Friday, 28 August 2020 at 12:29:20 UTC, Simen Kjærås wrote:
Seems that these methods should be rooted out from Object, and
placed in respective interfaces like:
-
interface Equatable(T) {
bool opEquals(T
On Friday, 28 August 2020 at 10:42:09 UTC, Alexandru Ermicioi
wrote:
No that is not a solution at all, in template code that
requires safety. You basically will have to sacrifice safety
for rest of types, such as structs, unions & enums for the sake
of objects being able to compare.
Yup.
On Friday, 28 August 2020 at 08:16:01 UTC, Alexandru Ermicioi
wrote:
Hi everyone,
there is https://issues.dlang.org/show_bug.cgi?id=21180 bug,
anyone knows how to avoid it?
Test case:
-
import std;
class Silly {
bool opEquals(const Silly silly) const @safe {
return
On Tuesday, 18 August 2020 at 08:05:20 UTC, Per Nordlöw wrote:
On Tuesday, 18 August 2020 at 08:03:04 UTC, Per Nordlöw wrote:
Forgot to mention that I want to support variadic arguments to
`ctLog` similar to what is done with
And these arguments should be of any template argument kind,
not
On Monday, 17 August 2020 at 21:18:41 UTC, Per Nordlöw wrote:
I'm using
pragma(msg, __FILE__, "(", __LINE__, ",1): Debug: ", "A
useful debug message");
to print compile-time information formatted as standard
compiler diagnostics.
These are picked up by Emacs Flycheck and overlayed in
On Monday, 17 August 2020 at 08:07:32 UTC, novice3 wrote:
Hello.
I have wrapping Windows API functions, wich return 0 on success
and erroro code on failure.
I copy wenforce template as:
```
private T denforce(T, S)(T value, lazy S msg = null, string
file = __FILE__, size_t line = __LINE__)
On Saturday, 15 August 2020 at 23:59:36 UTC, Joel wrote:
../../JMiscLib/source/jmisc/base.d(176,2): Error: @safe
function jmisc.base.upDateStatus!string.upDateStatus cannot
call @system function
std.stdio.makeGlobal!"core.stdc.stdio.stdout".makeGlobal
On Wednesday, 5 August 2020 at 09:32:58 UTC, Flade wrote:
Thanks! You see it should work but the thing is. I'm using it
inside a function. I'm checking for one of the function's
parameter (if parameter == false) and it says that "the
variable `parameter` cannot be read at compile time. Do you
On Wednesday, 5 August 2020 at 09:05:36 UTC, Flade wrote:
I have used an if-else statement to create an alias to avoid
code duplication but it doesn't let me access it outside the if
statement. Is there a way to solve this?
You're probably looking for static if:
static if (useAlias) {
On Tuesday, 21 July 2020 at 13:42:15 UTC, Steven Schveighoffer
wrote:
On 7/21/20 8:34 AM, Adam D. Ruppe wrote:
The others aren't wrong about stack size limits playing some
role, but the primary reason is that it is a weird hack for
@safe, believe it or not.
...
I don't recall exactly when
On Friday, 10 July 2020 at 10:13:23 UTC, wjoe wrote:
However stack memory needs to be allocated at program start. I
don't see a huge benefit in allocation speed vs. heap
pre-allocation, or is there?
I mean 1 allocation vs 2 isn't going to noticeably improve
overall performance.
You seem to
On Thursday, 9 July 2020 at 12:12:06 UTC, wjoe wrote:
I'm not considering supposed performance benefits/penalties
because these need to be profiled.
Considering the many downsides why would I ever want to choose
a static over a dynamic array ?
Simply put: static arrays are not dynamic
On Friday, 3 July 2020 at 07:58:31 UTC, Nick Treleaven wrote:
On Thursday, 25 June 2020 at 13:17:55 UTC, jmh530 wrote:
Good piece. I've been following the recent thread, but this
really helped make some things clear.
Do you have a link to that thread (or title) please?
Pretty sure it's the
On Wednesday, 1 July 2020 at 07:52:28 UTC, AB wrote:
Hello. I am unsure how to proceed about printing progress in my
program.
Suppose the program is processing a very big file and is
iterating the file's bytes using a for loop. The processing
takes several minutes and I want a progress
On Wednesday, 1 July 2020 at 07:26:44 UTC, Anthony wrote:
When doing interop with a c library, is there a way to
automatically generate the fields that are needed for a struct?
[snip]
Is there an easier way though?
Dstep is probably what you're looking for:
On Tuesday, 30 June 2020 at 12:18:14 UTC, Steven Schveighoffer
wrote:
I can see where it would be confusing, and it could probably
contain an example and clarification.
https://issues.dlang.org/show_bug.cgi?id=20997
On Tuesday, 30 June 2020 at 13:44:38 UTC, aberba wrote:
On Tuesday, 30 June 2020 at 12:48:32 UTC, Simen Kjærås wrote:
On Tuesday, 30 June 2020 at 08:15:54 UTC, aberba wrote:
On Tuesday, 30 June 2020 at 00:33:41 UTC, Ali Çehreli wrote:
On 6/29/20 4:34 PM, aberba wrote:
> So with this, with
On Tuesday, 30 June 2020 at 08:15:54 UTC, aberba wrote:
On Tuesday, 30 June 2020 at 00:33:41 UTC, Ali Çehreli wrote:
On 6/29/20 4:34 PM, aberba wrote:
> So with this, without the Thread.sleep() to block main from
exiting, the
> spawned thread will terminate immediately.
You can call
On Friday, 26 June 2020 at 13:21:25 UTC, drathier wrote:
How can I tell the compiler that I will never create a value of
type X, while still being able to write code that uses it?
Using void as a template parameter is where I started, but I
still need to be able to declare variables inside
On Tuesday, 23 June 2020 at 04:01:45 UTC, Denis wrote:
(1) Assign an unused value for the flag (e.g. -1 when the
function returns an int), and return the combined value/flag.
This happens in some Phobos algorithms, and might be the most
common on this list.
(2) Return a tuple with the
On Sunday, 21 June 2020 at 00:06:12 UTC, Paul Backus wrote:
import addle;
import std.range;
// Import a type from another module
import mylib: MyStruct;
// Define range primitives for MyStruct
bool empty(MyStruct a) { return false; }
string front(MyStruct a) {
On Thursday, 18 June 2020 at 14:43:54 UTC, H. S. Teoh wrote:
I have an array of input data that I'm looping over, and, based
on some condition, generate new items that are appended onto a
target array (which may already contain data). Since the
creation of new items is quite expensive, I'm
On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote:
Should a range-compliant aggregate type realizing a parser be
encoded as a struct or class? In dmd `Lexer` and `Parser` are
both classes.
In general how should I reason about whether an aggregate type
should be encoded as a
On Monday, 8 June 2020 at 09:08:40 UTC, adnan338 wrote:
On Monday, 8 June 2020 at 08:10:19 UTC, Simen Kjærås wrote:
On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote:
Self* searchTree(this Self)(auto in ref T item) const {
if ( is null)
return null
On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote:
Self* searchTree(this Self)(auto in ref T item) const {
if ( is null)
return null;
if (this.item == item)
return
return (this.item < item) ?
this.right.searchTree(item) :
On Monday, 8 June 2020 at 06:13:36 UTC, mw wrote:
Hi,
I have this program:
import std.stdio;
void f(ref int[] arr) {
arr ~= 3;
}
void main() {
int[][] arrs;
int[] arr;
foreach (i; 0 .. 3) {
On Wednesday, 3 June 2020 at 15:25:51 UTC, Paul Backus wrote:
On Wednesday, 3 June 2020 at 13:24:17 UTC, Basile B. wrote:
This is because the template parameter must be resolved to a
valid symbol or type.
This version other version bypass the problem:
---
enum Exists(string s) =
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote:
You can use this template:
enum Exists(alias T) = is(typeof(T));
I don't know if there's a faster way bu this technic is used,
notatbly in phobos, to workaroud issues of double declaration
in `static foreach`
enum Exists(alias
On Wednesday, 27 May 2020 at 11:03:51 UTC, BoQsc wrote:
I'm lacking knowledge on how to achieve what I want and getting
an error.
What is the correct way to do what I tried to achieve in this
code?
Everything was intuitive until I started to add notice variable
to the writeln. Rdmd says
On Sunday, 24 May 2020 at 08:57:28 UTC, Luis wrote:
dmd ignores @trusted or @safe on opEquals, throwing this error :
onlineapp.d(27): Error: @safe function
onlineapp.__unittest_L24_C7 cannot call @system function
object.opEquals
An override @system or @trusted function can't be @safe, or I
On Wednesday, 20 May 2020 at 13:51:05 UTC, Steven Schveighoffer
wrote:
Please file an issue.
https://issues.dlang.org/show_bug.cgi?id=20850
--
Simen
On Monday, 11 May 2020 at 12:44:45 UTC, Jack Applegame wrote:
On Monday, 11 May 2020 at 12:30:22 UTC, Adam D. Ruppe wrote:
UFCS is only defined to work with global scope functions. A
restricted import (module : symbol, symbols) puts things in
local scope so ufcs doesn't apply.
But in this
On Monday, 11 May 2020 at 11:20:51 UTC, Joel wrote:
I'm gotten stuck with this error - "..is not visible from
module.."
Without some code it's hard to say exactly, but this generally
means you're referencing a private symbol in a different module:
module foo;
private struct S {}
module
On Saturday, 9 May 2020 at 19:54:44 UTC, Pavel Shkadzko wrote:
I have been reading about memory management in D on
https://wiki.dlang.org/Memory_Management and found an example
of a free list (pattern?): "Free lists are a great way to
accelerate access to a frequently allocated and discarded
On Friday, 8 May 2020 at 13:09:49 UTC, kinke wrote:
On Friday, 8 May 2020 at 12:49:00 UTC, Simen Kjærås wrote:
How would I go about calling _mm_* functions in D in a way
that is portable between D compilers?
You would use core.simd:
Nope one wouldn't, because that horrible interface isn't
On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:
Hi,
I am building a CRC32C implementation using SSE for D, because
I couldn't find any readily available :[
However, I am unable to find any documentation regarding which
SSE instructions are available and how I could use them in
On Thursday, 7 May 2020 at 10:21:07 UTC, Dukc wrote:
Is there some way to measure the performance of a function so
that the results will be same in different computers (all x86,
but otherwise different processors)? I'm thinking of making a
test suite that could find performance regressions
On Thursday, 7 May 2020 at 09:22:28 UTC, learner wrote:
Good morning,
Is there a reason why std.variant.visit is not inferring pure?
```
void test() pure {
Algebraic!(int, string) alg;
visit!( (string) => 0, (int) => 0)(alg);
}
Error: pure function test cannot call impure function
On Tuesday, 5 May 2020 at 04:02:06 UTC, RazvanN wrote:
truct K
{
~this() nothrow {}
}
void main()
{
static class C
{
this(K, int) {}
}
static int foo(bool flag)
{
if (flag)
throw new Exception("hello");
return 1;
}
try
{
On Friday, 1 May 2020 at 20:28:58 UTC, Jean-Louis Leroy wrote:
Is it possible, inside a function template, to create an alias
to the instantiated function? IOW the equivalent of
__FUNCTION__, but yielding an alias?
The closest I came is:
import std.string;
import std.traits;
void
On Thursday, 30 April 2020 at 13:23:25 UTC, Paul Backus wrote:
On Thursday, 30 April 2020 at 13:04:47 UTC, Casey wrote:
Here's a minimal code example that duplicates the issue:
import std.array, std.range, std.stdio, std.traits, std.string;
auto readStream(Range)(auto ref Range r) if
On Wednesday, 29 April 2020 at 20:43:20 UTC, Casey wrote:
void popFront()
{
}
I mean, it might be you messed up in posting this, but having an
empty popFront and expecting it to do something is a tad
optimistic.
Apart from that, it seems like
On Wednesday, 29 April 2020 at 09:16:58 UTC, user1234 wrote:
The static checker doesn't see your free funcs because to do so
it would have to import the whole module. (is it possible to do
that ? no idea.)
Of course it's possible! :) We can find the context of R (in this
case, the module)
On Wednesday, 29 April 2020 at 08:34:53 UTC, Ogi wrote:
struct R {}
int front(R r) { return 42; }
void popFront(R r) {}
bool empty(R r) { return false; }
void main() {
import std.range.primitives : isInputRange;
static assert(isInputRange!R);
}
Error: static assert:
On Saturday, 18 April 2020 at 15:47:38 UTC, Marcone wrote:
How convert String to Hex?
Example:
string text = "Hello World"; // Converted to Hex =
48656c6c6f20576f726c64
import std.format : format;
string hex = format("%(%2x%)", "Hello World");
import std.stdio : writeln;
On Saturday, 18 April 2020 at 09:19:48 UTC, Simen Kjærås wrote:
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh
wrote:
I wonder if the ultimate cause of the above case is ultimately
caused by
the change to import semantics that hid private symbols from
outside the
module. Perhaps
On Wednesday, Friday, 17 Apr 2020 17:45:47 UTC, H. S. Teoh wrote:
I wonder if the ultimate cause of the above case is ultimately
caused by
the change to import semantics that hid private symbols from
outside the
module. Perhaps something, somewhere, is triggering an illegal
access of
a
On Friday, 17 April 2020 at 16:54:42 UTC, Adam D. Ruppe wrote:
This part seems fine...
pragma(msg, ParameterDefaults!f.stringof);
It is this, specifically, that causes the problem. Replace it
with:
void main() {
import std.stdio;
writeln(ParameterDefaults!f.stringof);
}
On Friday, 17 April 2020 at 08:59:19 UTC, kdevel wrote:
On Friday, 17 April 2020 at 04:29:06 UTC, Meta wrote:
Unlike C/C++, char is not a numeric type in D; It's a UTF-8
code point:
Thanks, it's a code /unit/. main reads now:
void main ()
{
bar!ubyte;
bar!byte;
bar!ushort;
On Sunday, 29 March 2020 at 14:04:53 UTC, TodNaz wrote:
Hello!
class A
{
...
}
class B : A
{
...
}
class C : A
{
...
}
A example1;
B example2 = new B(...);
A = example2;
auto heir = A.whoheir(); ///
The question in this code is: is it possible to track the class
inheritor? Or is
On Sunday, 15 March 2020 at 20:18:03 UTC, James Blachly wrote:
I would like to programmatically retrieve members of a subclass
to create a self-documenting interface. I am afraid that my
approach is not possible due to need for compile time __traits
/ std.traits, and runtime typeinfo. My
On Thursday, 12 March 2020 at 08:51:24 UTC, mark wrote:
I use sets a lot and since I believe that D's rbtree is O(lg n)
for add/remove/in and that D's AA is O(1) for these, I want to
implement a set in terms of an AA.
Below is the code I've got so far. It allows for add and
remove. However,
On Wednesday, 11 March 2020 at 12:43:28 UTC, mark wrote:
On Wednesday, 11 March 2020 at 12:22:21 UTC, Simen Kjærås wrote:
On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote:
[snip]
Fascinating. It works just fine when compiling for 32-bit
targets with DMD on Windows, but not for 64-bit
On Wednesday, 11 March 2020 at 09:29:54 UTC, mark wrote:
Hi Simen,
I think you must have done something else but didn't mention to
get it to compile. I did the exact changes you said and it
wouldn't compile. Here's what I get with changes mentioned
below (with new full source):
On Tuesday, 10 March 2020 at 20:03:21 UTC, mark wrote:
I've managed to make a cut-down version that's < 170 LOC.
It needs to be run on Debian or a Debian-based Linux (e.g.,
Ubuntu).
Hopefully this will help someone understand and be able to help!
This took some time figuring out. Turns out,
On Tuesday, 10 March 2020 at 08:13:19 UTC, mark wrote:
I have this struct:
struct Deb {
string name;
...
Unit[string] tags; // set of tags
Deb dup() const {
Deb deb;
deb.name = name;
...
foreach (key; tags.byKey)
deb.tags[key] = unit;
On Monday, 9 March 2020 at 09:25:31 UTC, Calvin P wrote:
Is this a bugs ?
==
struct A {
ref auto opCall(string tmp) scope return {
return this;
}
}
struct B {
A _a;
@property ref auto a() scope return {
return _a;
On Saturday, 7 March 2020 at 15:44:38 UTC, Arine wrote:
The case when there isn't a value should be handled explicitly,
not implicitly. Propogating a None value
isn't useful
Except when it is useful, and shouldn't be handled explicitly. I
have code in D, C and C++ that looks like this:
On Thursday, 5 March 2020 at 08:35:52 UTC, drug wrote:
On 3/5/20 10:47 AM, mark wrote:
In Adam Ruppe's D Cookbook there're these lines in a ref
counting example:
RefCountedObject o = void; // What does this mean/do?
o.data = new Implementation();
o.data.refcount = 1;
I don't understand the
On Friday, 28 February 2020 at 10:33:11 UTC, Виталий Фадеев wrote:
Thanks all !
I happy !
Check this one:
void On( T, M )( T o, M message )
{
[snip]
void main()
{
auto a = new A();
a.Send( a, WM_KEYUP );
a.Send( a, WM_KEYDOWN );
}
That does mostly
On Friday, 28 February 2020 at 09:25:58 UTC, Виталий Фадеев wrote:
Yes. Thank !
I read it.
Problem is - OS has many messages + user messages... It mean
what interfaces like IKeyDown must me declared. All. Dream on
write less code...
So let's create a template for that:
interface
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев wrote:
Searching solution for idea !
For whatever reason, it seems my attempts at answering this
earlier has disappeared into the void. Here:
import core.sys.windows.windows;
import std.stdio;
class Base {
LRESULT On(UINT
On Friday, 28 February 2020 at 08:08:59 UTC, Виталий Фадеев wrote:
On Friday, 28 February 2020 at 06:12:37 UTC, Виталий Фадеев
wrote:
Searching solution for idea !
Goal is to get System message, dispatch/route to method !
If method implemented only !
I dream on in future write clean code of a
On Thursday, 27 February 2020 at 11:28:11 UTC, Mitacha wrote:
I've a const struct object and I'd like to make a mutable copy
of it.
Struct definition contains string and an array of structs.
```
struct A {
string a;
B[] b;
}
struct B {
string a;
string b;
}
```
As far as I can
On Wednesday, 26 February 2020 at 08:32:50 UTC, Abby wrote:
On Wednesday, 26 February 2020 at 08:25:00 UTC, Abby wrote:
Any idea why?
Ok so this is enough to produce the same result, it seems that
there is a problem in string switch when there is more the 6
cases.
extern(C) void main()
{
On Tuesday, 18 February 2020 at 12:43:22 UTC, Adnan wrote:
class Wife(uint N) : Female {
FemaleID engagedTo = -1;
const MaleID[N] preferences;
this(MaleID[N] preferences) {
this.preferences = preferences;
}
}
void engage(N)(ref Wife!N, wife, ref Husband!N husband) {
On Tuesday, 18 February 2020 at 12:37:45 UTC, Adnan wrote:
I have a base class that has a couple of constant member
variables. These variables are abstract, they will only get
defined when the derived class gets constructed.
class Person {
const string name;
const int id;
}
class
On Monday, 17 February 2020 at 14:04:34 UTC, Adnan wrote:
cdsa ~master: building configuration "cdsa-test-library"...
source/strassens_matmul.d(22,16): Error: cannot implicitly
convert expression [row][column] of type const(uint)* to
uint*
source/strassens_matmul.d(37,36): Error: template
On Monday, 17 February 2020 at 13:03:38 UTC, Basile B. wrote:
eg
Sh(echo) < "meh";
struct Sh
{
// you see the idea we have op overload for < here
}
You can't overload < separately - all the comparison operators
(<, <=, >, >=) are handled via opCmp. Even if you choose to go
down
On Monday, 17 February 2020 at 11:51:52 UTC, FeepingCreature
wrote:
Here you go:
import std;
// extract the types that make up the tuple
auto transposeTuple(T : Tuple!Types[], Types...)(T tuples)
{
// templated function that extracts the ith field of an
array of tuples as an array
On Monday, 17 February 2020 at 11:51:52 UTC, FeepingCreature
wrote:
On Monday, 17 February 2020 at 11:07:33 UTC, foozzer wrote:
Hi all,
There's something in Phobos for that?
Thank you
Here you go:
import std;
// extract the types that make up the tuple
auto transposeTuple(T :
On Monday, 17 February 2020 at 11:07:33 UTC, foozzer wrote:
Hi all,
There's something in Phobos for that?
Thank you
import std.meta : staticMap;
import std.typecons : Tuple;
// Turn types into arrays
alias ToArray(T) = T[];
// Leave everything else the same
alias ToArray(T...) = T;
// Now
On Wednesday, 12 February 2020 at 08:44:24 UTC, cc wrote:
Is there some way to globally declare version= or debug=
statements in a file and have them apply to the entire project
being compiled? As the documentation says these only apply to
the module scope they exist in, and need to be added
On Tuesday, 28 January 2020 at 07:36:25 UTC, Malte wrote:
I want to format an array using the %(...%) syntax. How can I
change the separator? I tried to use ? and add it as additional
parameter, but that doesn't seem to work on arrays:
import std;
void main()
{
writeln("This works:");
1 - 100 of 615 matches
Mail list logo