Auto ref?
```D
int* getX(T)(auto ref T t)
{
...
```
On 13.12.2021 14:26, ag0aep6g wrote:
On 13.12.21 12:09, drug wrote:
That's because `str` is initialized by a literal and you can not
change it by definition. When you call `toStringz` it duplicates that
literal (adding terminating zero at the end) and the duplicate is
mutable. I would recommen
On 13.12.2021 13:49, forkit wrote:
On Monday, 13 December 2021 at 09:49:05 UTC, forkit wrote:
char* w = cast(char*)str.toStringz; // this seems to be the solution
class has ended ;-)
That's because `str` is initialized by a literal and you can not change
it by definition. When you cal
On 26.11.2021 12:16, Ferhat Kurtulmuş wrote:
I am working on the DCV to make it compilable with the recent versions
of LDC, mir libraries, and stuff. I have not yet simply forked it to
work on it. I am including modules one by one for my convenience
instead. Hope, I am close to the end. Here is
On 10.10.2021 18:01, Elmar wrote:
Well, I just wondered why your code would compile and mine wouldn't. The
`version(all)` variant will not compile on my computer with `rdmd`
because `PointerTarget` only allows pointers.
It depends on compiler version. This variant is compiled on version
2.0
You just need to check if T is a pointer:
```D
import std;
alias DA = int[];
alias SA = int[3];
alias PSA = SA*;
alias PDA = DA*;
version(all)
enum isPointedStaticArray(T) = isPointer!T &&
isStaticArray!(PointerTarget!T);
else
enum isPointedStaticArray(T) = isPointer!T && is(PointerTarget!T
10.09.2021 12:27, eugene пишет:
//import std.container.dlist; // dmd (v2.097.2)
import std.container: DList; // gdc (4.9.2)
It is off-topic a bit but I think none can compare gdc 4.9.2 to dmd
2.097.2 because gdc has older version than dmd. I would compare gdc to
appropriate dmd version, it
17.08.2021 15:21, Ferhat Kurtulmuş пишет:
Hello folks,
Hope everyone is doing fine. Considering the following code, in the
first condition, I am extracting the type Point from the slice Point[].
I searched in the std.traits, and could not find a neater solution
something like ElementTypeOf!T.
12.08.2021 14:32, Paul Backus пишет:
This is not true. Qualifying the ctor as `inout` works fine:
https://run.dlang.io/is/Kpzp5M
The problem in this example is that `.dup` always returns a mutable
array, even if the array being copied is `inout`. The solution is to
cast the copy back to the
12.08.2021 14:07, drug пишет:
12.08.2021 12:36, Learner пишет:
> It seems that there is no easy way to transition from a postblit to a
copy constructor, no?
You just need both const and mutable copy ctors to replace inout one:
```D
struct A {
int[] data;
this(ref return scope A
12.08.2021 12:36, Learner пишет:
> It seems that there is no easy way to transition from a postblit to a
copy constructor, no?
You just need both const and mutable copy ctors to replace inout one:
```D
struct A {
int[] data;
this(ref return scope A rhs) { data = rhs.data.dup; }
28.07.2021 17:39, Mathias LANG пишет:
On Wednesday, 21 July 2021 at 22:51:38 UTC, hanabi1224 wrote:
Hi, I'm new to D lang and encounter some performance issues with
fiber, not sure if there's something obviously wrong with my code.
I took a quick look, and the first problem I saw was that you
I wouldn't state it is the best way but you can try something like that:
```D
import std.complex;
import std.range : zip;
import std.algorithm : equal, map;
import std.array : array;
void main(){
auto N=2;
double[] x,y;
x.length = N;
y.length = N;
x[0] = 1.1;
x[1] = 2.2;
08.07.2021 19:11, Виталий Фадеев пишет:
I fix source code, as drug say.
I've fixed the issue upstream, shortly gfm7 v1.1.2 will be available.
08.07.2021 18:46, Виталий Фадеев пишет:
On Thursday, 8 July 2021 at 15:30:07 UTC, drug wrote:
08.07.2021 17:20, Виталий Фадеев пишет:
[...]
I failed to reproduce that. What platform you use and what is the
compiler version?
drug, Linux, Ubuntu, x64
# uname -a
Linux unknown 5.11.0-22-generi
08.07.2021 17:20, Виталий Фадеев пишет:
vital@unknown:~/src/dtest/working-example/gfm7/examples/simpleshader$
dub run
Fetching bindbc-opengl 0.15.0 (getting selected version)...
Fetching colorize 1.0.5 (getting selected version)...
Fetching gfm 8.0.6 (getting selected version)...
Fetching bind
08.07.2021 16:51, Виталий Фадеев пишет:
Hi!
I searching trivial simple D/OpenGL working in 2021 year example.
It may be triangle.
It may be based on any library: SDL, GLFW, Derelict, etc.
Can you help me ?
https://github.com/drug007/gfm7/tree/master/examples/simpleshader
it's not trivial t
06.07.2021 13:06, Jack Applegame пишет:
Code:
```d
import std.stdio;
struct Field {
void opAssign(int a) {
writefln("Field.opAssign(%s)", a);
}
}
struct Register {
Field clock(int a) {
writefln("Register.clock(%s)", a);
return Field();
}
}
void m
07.06.2021 17:02, Prokop Hapala пишет:
Basically I'm desperate do find anything which encapsulates OpenGL calls
into some nice D-lang classes
Did you try gfm? specifically its 7th version -
[gfm7](https://github.com/drug007/gfm7)?
It has nice
[classes](https://github.com/drug007/gfm7/tree/mas
02.06.2021 12:50, Ola Fosheim Grøstad пишет:
Depends on the data, I guess, if they are all visible at once then you
basically have to very carefully write your own GPU render stage for
that view and carefully cache things that does not move by rendering
them to buffers (in GPU memory).
Usuall
02.06.2021 00:47, Ola Fosheim Grøstad пишет:
Note: Many simple GUI toolkits are horribly inefficient as they let each
object render themselves. An efficient GUI engine will have to
replicate some of the browser complexity...
I tried retained and immediate GUI, both fail (imho) for my use case
21.05.2021 16:45, newbie пишет:
I am following
https://wiki.dlang.org/Defining_custom_print_format_specifiers, why sink
and formatValue are not @safe? What are the best practice for toString
in safe code? Thank you
sink is obsolete now, use W(riter)
```D
import std.range : isOutputRange;
vo
21.05.2021 15:39, Alain De Vos пишет:
I'll have a look at that website.
With this code I capture the mouse press event
```
this()
{
addEvents(GdkEventMask.BUTTON_PRESS_MASK);
addOnDraw(&drawCallback);
addOnButtonPress(&onButtonPress);
}
```
```
public bool onButtonPress(Event event, Widget wid
13.05.2021 16:30, Alain De Vos пишет:
Shouldn't the compiler error it is not pure ?
Or have I a wrong understanding of pure or the compiler.
The function is pure. If you call it several times passing the same
argument it will return the same result.
https://run.dlang.io/is/futqjP
11.05.2021 12:10, Vinod K Chandran пишет:
Hi all,
I am practising D with a win api GUI hobby project.
I have a Window class and it resides in module window.d
My WndProc function resides in another module named wnd_proc_module.d
Inside my WndProc, I get the Window class like this.
```d
Window win
21.04.2021 16:19, Alain De Vos пишет:
import std.stdio;
void main(){
struct List {
struct Node {
float f;
Node *next;
}
Node * root=null;
bool empty() const {return !root;}
void popFront() {root=root.next;}
f
02.04.2021 15:06, Ali Çehreli пишет:
For those who prefer a video description with some accent :) here is how
What about accent - I'm curious what would you say about this old
Russian sketch about English and its dialects (in English, no facebook
account required):
https://www.facebook.co
I use asdf https://code.dlang.org/packages/asdf
Also vibe-d https://code.dlang.org/packages/vibe-d has
vibe-d:data subpackage
On 3/16/21 1:58 AM, David Skluzacek wrote:
>
> Error: template std.algorithm.iteration.splitter cannot deduce
function from argument types !()(GZippedFile, string), candidates are:
> /usr/include/dlang/dmd/std/algorithm/iteration.d(4678):
splitter(alias pred = "a == b", Range, Separator)(Range r
On 2/10/21 2:52 PM, JG wrote:
On Tuesday, 9 February 2021 at 18:33:16 UTC, drug wrote:
On Tuesday, 9 February 2021 at 07:45:13 UTC, JG wrote:
I was trying to profile a d program. So I ran: dub build
--build=profile. I then ran the program and it produced trace.log and
trace.def. I then ran d-p
On Tuesday, 9 February 2021 at 07:45:13 UTC, JG wrote:
I was trying to profile a d program. So I ran: dub build
--build=profile. I then ran the program and it produced
trace.log and trace.def. I then ran d-profile-viewer and got
the following error:
std.conv.ConvException@/home/jg/dlang/ldc-1
On 1/29/21 8:20 PM, 9il wrote:
On Friday, 29 January 2021 at 15:35:49 UTC, drug wrote:
Between is there a plan to implement some sort of static slice where
the lengths of the dimensions are known in compile time? Compiler help
is very useful.
No. BLAS/LAPACK API's can't use compile-time infor
On 1/29/21 4:50 PM, 9il wrote:
On Tuesday, 26 January 2021 at 14:43:08 UTC, drug wrote:
It is not easy to understand what mir library one should use to work
with matrices. mir-glas turns out unsupported now and I try to use
mir-blas. I need to reimplement my Kalman filter version to use more
h
It is not easy to understand what mir library one should use to work
with matrices. mir-glas turns out unsupported now and I try to use
mir-blas. I need to reimplement my Kalman filter version to use more
high dimension matrix than 4x4 plus Kronecker product. Is mir-blas
recommended to work wit
On 1/19/21 9:28 PM, Per Nordlöw wrote:
On Tuesday, 19 January 2021 at 16:14:17 UTC, drug wrote:
https://dlang.org/phobos/std_bitmanip.html#FloatRep
Doesn't this pattern already cover all possible cases of `value` needed?
void f(double value)
{
auto lvalue = cast(long)value;
if (l
On 1/19/21 6:50 PM, Ali Çehreli wrote:
On 1/19/21 6:04 AM, drug wrote:
> Another (low level) way is to shift mantissa left by exponent value.
Luckily, we already have a helper in Phobos:
https://dlang.org/phobos/std_bitmanip.html#FloatRep
Ali
That makes life simpler, thanks for sharing
On 1/19/21 5:04 PM, drug wrote:
On 1/19/21 4:48 PM, Per Nordlöw wrote:
On Tuesday, 19 January 2021 at 13:36:58 UTC, Steven Schveighoffer wrote:
Use a cast instead.
const lvalue = cast(long)value;
Ahh, good point.
Followd by a compare of the original value I presume.
don't forget to check
On 1/19/21 4:48 PM, Per Nordlöw wrote:
On Tuesday, 19 January 2021 at 13:36:58 UTC, Steven Schveighoffer wrote:
Use a cast instead.
const lvalue = cast(long)value;
Ahh, good point.
Followd by a compare of the original value I presume.
don't forget to check by std.math.isFinite before casti
On 1/14/21 7:06 PM, dog2002 wrote:
On Thursday, 14 January 2021 at 16:01:43 UTC, drug wrote:
On 1/14/21 6:55 PM, drug wrote:
But this method consumes a huge amount of memory (up to 4 GB and
more). Is there a more appropriate way to walk directories
recursively that does not consume a lot of
On 1/14/21 7:30 PM, dog2002 wrote:
On Thursday, 14 January 2021 at 16:18:28 UTC, drug wrote:
On 1/14/21 7:06 PM, dog2002 wrote:
On Thursday, 14 January 2021 at 16:01:43 UTC, drug wrote:
[...]
Yes. I forgot to add it in the original post.
Does using `ref` changed anything?
Try following:
``
On 1/14/21 7:06 PM, dog2002 wrote:
On Thursday, 14 January 2021 at 16:01:43 UTC, drug wrote:
On 1/14/21 6:55 PM, drug wrote:
But this method consumes a huge amount of memory (up to 4 GB and
more). Is there a more appropriate way to walk directories
recursively that does not consume a lot of
On 1/14/21 6:55 PM, drug wrote:
But this method consumes a huge amount of memory (up to 4 GB and
more). Is there a more appropriate way to walk directories recursively
that does not consume a lot of memory?
DirEntry is a struct. First of all I would try this:
```D
foreach(ref entry; dirEntri
On 1/14/21 6:46 PM, dog2002 wrote:
I need to make some operations with all the files in a directory and
subdirectories. Currently, I do it like this:
import std;
void DirIteration(string path) {
try {
foreach(entry; dirEntries(path, SpanMode.shallow, false)) {
//SpanMode.shallow
On 1/13/21 4:47 PM, Roguish wrote:
Also, what does it mean to "always emit a stackframe" (compiler option
-gs) ?
Short answer - sometimes the compiler does not emit a stackframe (due to
optimization for example). In general if you are able to debug your
binary by gdb then you don't need to
On 1/13/21 4:47 PM, Roguish wrote:
On Wednesday, 13 January 2021 at 13:30:48 UTC, Roguish wrote:
Anything else I need to know when debugging on Linux, without an IDE?
One specific question I have is: what's the difference between -g and
-debug and -d-debug?
Also, what does it mean to "alway
On 12/23/20 3:23 PM, Godnyx wrote:
Any ideas?
Just fix your typos:
```D
import std : printf, toStringz;
void put(A...)(string prompt, A args) {
static foreach (ulong i; 0..args.length) {
static if (is(typeof(args[i]) == string))
printf("%s\n", args[i].toStringz);
On 12/22/20 8:32 PM, jmh530 wrote:
On Tuesday, 22 December 2020 at 15:06:09 UTC, drug wrote:
[snip]
But what do you mean exactly by "work with dependency"? As I
understand, `dub test` does not run unit tests in dependencies and
single file packages work with dependencies in general. Do you m
On 12/22/20 10:52 AM, drug wrote:
On 12/21/20 7:31 PM, jmh530 wrote:
On Monday, 21 December 2020 at 11:31:49 UTC, drug wrote:
[snip]
Unfortunately I'm very busy. But I check it again and it turns out
that the fix does not resolve the problem completely. This PR just
remove the single file fro
On 12/21/20 7:31 PM, jmh530 wrote:
On Monday, 21 December 2020 at 11:31:49 UTC, drug wrote:
[snip]
Unfortunately I'm very busy. But I check it again and it turns out
that the fix does not resolve the problem completely. This PR just
remove the single file from testing so currently dub does not
On 12/20/20 9:31 PM, jmh530 wrote:
On Wednesday, 2 December 2020 at 12:51:11 UTC, drug wrote:
[snip]
Thanks! Let's see if it gets merged or if a slightly more involved
solution is needed.
Remake it - https://github.com/dlang/dub/pull/2052
This has more chances to be merged
Looks like this
Phobos provides this by SortedRange:
https://dlang.org/phobos/std_range.html#.SortedRange
Example of usage:
https://run.dlang.io/is/WW2bn0
On 12/1/20 5:18 PM, Johannes Loher wrote:
Am 01.12.20 um 14:55 schrieb drug:
On 12/1/20 2:40 PM, Johannes Loher wrote:
...
However, I am having trouble running the unit tests when using the
...
This can be one of solution https://github.com/dlang/dub/pull/2050
Thanks! Let's see if it gets
On 12/1/20 2:40 PM, Johannes Loher wrote:
...
However, I am having trouble running the unit tests when using the
...
This can be one of solution https://github.com/dlang/dub/pull/2050
On 11/2/20 1:50 PM, Severin Teona wrote:
Hi guys!
I build the druntime for an ARM Cortex-M based microcontroller and I
trying to create an application and link it with the druntime. I am also
using TockOS[1], which does not implement POSIX thread calls and other
OS-dependent implementations.
There are two other way:
```D
import std;
void main()
{
int[] a = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ];
// using foreach
foreach (i; 0..a.length)
write(a[i], ", ");
writeln;
// using stride
writeln(stride(a, 2));
}
```
On 10/20/20 9:42 AM, Per Nordlöw wrote:
If I want GC-free string formatting and outputting to stdout/stderr what
packages should I prefer at code.dlang.org?
Probably https://code.dlang.org/packages/nogc
On 10/5/20 12:05 PM, Alaindevos wrote:
On Monday, 5 October 2020 at 08:54:39 UTC, Daniel Kozak wrote:
On Mon, Oct 5, 2020 at 10:25 AM Alaindevos via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
Can I say python has pip, ruby has bundle and D has dub.
Meaning they perform th
On 9/29/20 4:38 PM, drug wrote:
It reproduces. As a workaround you can use
```
dub run profdump
```
this command works as expected, I guess it is a bug of dub
Do not execute this command in cloned `profdump` repository - it will
fail too. It works if is called from other places, for example i
On 9/29/20 3:41 PM, mw wrote:
I remember I used to able to build this package:
https://github.com/AntonMeep/profdump
but now, I cannot.
Since that package haven't changed for 2 years, maybe it's a dub bug?
System information
$ uname -a
Linux 4.15.0-117-generic #118-Ubuntu SMP Fri Sep 4 20:
On 9/18/20 4:30 PM, drug wrote:
Can't you put a var on the stack?
```
auto instance = create();
instance
.do_lazy()
.do_something();
```
Ah, I totally missed your point. Now I see you can't...
Can't you put a var on the stack?
```
auto instance = create();
instance
.do_lazy()
.do_something();
```
On 9/10/20 4:06 PM, Joseph Rushton Wakeling wrote:
Hello folks,
Is there any way to define UDAs such that they automatically inherit
other UDA definitions?
For example, suppose I define:
enum BaseUDA { A, B }
Is there a way to define `AnotherUDA` such that if `hasUDA!(T,
AnotherUDA)`
05.09.2020 23:19, Andy Balba пишет:
https://github.com/vibe-d/eventcore/blob/a027c233c2542de8372bbff25d0a4804f32a094e/source/eventcore/driver.d#L1087
@drug: thank you..I'm now left with resolving @blocking
you are welcome!
Probably this?
https://github.com/vibe-d/vibe-core/blob/6ceb462ab
05.09.2020 22:17, Andy Balba пишет:
Where do I fine where IOMode is defined.. as in the last line of ...
module vibe.core.stream;
import vibe.internal.traits : checkInterfaceConformance,
validateInterfaceConformance;
import vibe.internal.interfaceproxy;
import core.time;
import std.algorithm
On 9/4/20 10:27 AM, glis-glis wrote:
On Thursday, 3 September 2020 at 14:34:48 UTC, Jacob Carlborg wrote:
Oh, multiple binaries, I missed that. You can try to add multiple
configurations [1]. Or if you have executables depending on only one
source file, you can use single-file packages [2].
T
On 9/3/20 3:36 PM, Thomas wrote:
Hi!
I am following some examples in C++ about how OpenGL is working. There
are great tutorials out there and most of it works also with D.
For my code I am using gfm.math.matrix (Version 8.0.3) to be able to
calculate the mouse position in a 3d world.
Now I ha
On 9/3/20 1:47 PM, Curious wrote:
Given the following:
=a==
void main(string[] args)
{
FILE* fp = fopen(args[1].ptr, "r");
if (!fp) throw new Exception("fopen");
}
=b==
void main(string[] args)
{
FILE* fp = fopen(args[1].dup.ptr, "r");
if (!fp) throw new Exce
On 7/21/20 2:44 PM, Ecstatic Coder wrote:
Ah thanks for telling me :)
The loaded byte array in the union type was indeed the same as the saved
one, so I immediately thought it was crashing because of some hidden
pointer for timezone or something which was then pointing to garbage at
reloadin
On 7/20/20 10:04 PM, Ecstatic Coder wrote:
I'm currently implementing a small open source backup tool (dub), and
therefore I need to accurately store the file modification SysTime in
binary format, so that I can later load this SysTime from the snapshot
file to compare it with the current file
23.05.2020 12:27, Tim пишет:
class Sprite{
/// Postional components of the sprite
int* x, y;
SDL_Surface* image_surface;
auto parent;
this(const char* path, auto parent){
writeln(*x);
this.parent = parent;
}
void update(){
// Copy lo
On 5/20/20 12:03 PM, realhet wrote:
On Wednesday, 20 May 2020 at 01:18:24 UTC, Paul Backus wrote:
On Tuesday, 19 May 2020 at 23:15:45 UTC, realhet wrote:
I think what you want is `std.meta.staticMap`. Something like this:
alias FieldNameTuple2(T) = staticMap!(FieldNameTuple,
BaseClassesTuple!T
On 5/18/20 11:47 PM, Vinod K Chandran wrote:
On Sunday, 17 May 2020 at 19:37:05 UTC, drug wrote:
17.05.2020 17:35, Vinod K Chandran пишет:
It worked. Thanks :) I have one more question. Which is better, to
include all the switch cases inside a single try catch or write
separate try catch for
17.05.2020 17:35, Vinod K Chandran пишет:
It worked. Thanks :) I have one more question. Which is better, to
include all the switch cases inside a single try catch or write separate
try catch for each switch cases ?
all the switch cases inside a single try catch is better
07.05.2020 17:49, data pulverizer пишет:
On Thursday, 7 May 2020 at 02:06:32 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 10:23:17 UTC, data pulverizer wrote:
D: ~ 1.5 seconds
This is going to sound absurd but can we do even better? If none of
the optimizations we have so far
06.05.2020 13:23, data pulverizer пишет:
On Wednesday, 6 May 2020 at 08:28:41 UTC, drug wrote:
What is current D time? ...
Current Times:
D: ~ 1.5 seconds
Chapel: ~ 9 seconds
Julia: ~ 35 seconds
Oh, I'm impressed. I thought that D time has been decreased by 1.5
seconds but it is 1.5
06.05.2020 16:57, Steven Schveighoffer пишет:
```
foreach(i; 0..n) // instead of for(long i = 0; i < n;)
```
I guess that `proc` delegate cant capture `i` var of `foreach` loop so
the range violation doesn't happen.
foreach over a range of integers is lowered to an equivalent for loop,
so tha
06.05.2020 12:07, wjoe пишет:
Hello,
I'm choking on a piece of C++ I have no idea about how to translate to D.
template typename std::enable_if< std::is_const::value == true,
void>::type* = nullptr>
constexpr const char *modifier() const {
return "[in] ";
}
06.05.2020 11:18, data pulverizer пишет:
CPU usage now revs up almost has time to touch 100% before the process
is finished! Interestingly using `--boundscheck=off` without
`--ffast-math` gives a timing of around 4 seconds and, whereas using
`--ffast-math` without `--boundscheck=off` made no
06.05.2020 10:42, data pulverizer пишет:
On Wednesday, 6 May 2020 at 07:27:19 UTC, data pulverizer wrote:
On Wednesday, 6 May 2020 at 06:54:07 UTC, drug wrote:
Thing are really interesting. So there is a space to improve
performance in 2.5 times :-)
Yes, `array` is smart enough and if you call
06.05.2020 09:43, data pulverizer пишет:
On Wednesday, 6 May 2020 at 05:50:23 UTC, drug wrote:
General advice - try to avoid using `array` and `new` in hot code.
Memory allocating is slow in general, except if you use carefully
crafted custom memory allocators. And that can easily be the reason
06.05.2020 09:24, data pulverizer пишет:
On Wednesday, 6 May 2020 at 05:44:47 UTC, drug wrote:
proc is already a delegate, so &proc is a pointer to the delegate,
just pass a `proc` itself
Thanks done that but getting a range violation on z which was not there
before.
```
core.exception.Ra
06.05.2020 07:52, data pulverizer пишет:
On Wednesday, 6 May 2020 at 04:04:14 UTC, Mathias LANG wrote:
On Wednesday, 6 May 2020 at 03:41:11 UTC, data pulverizer wrote:
Yes, that's exactly what I want the actual computation I'm running is
much more expensive and much larger. It shouldn't matter
06.05.2020 07:25, data pulverizer пишет:
On Wednesday, 6 May 2020 at 03:56:04 UTC, Ali Çehreli wrote:
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 somethin
06.05.2020 06:25, data pulverizer пишет:
```
onlineapp.d(14): Error: template std.concurrency.spawn cannot deduce
function from argument types !()(void delegate(double x, double y, long
i, shared(double[]) z) pure nothrow @nogc @safe, double, double, long,
shared(double[])), candidates are:
/
01.05.2020 18:04, notna пишет:
hmmm, whích results in:
Error: cannot use [] operator on expression of type dchar
try this:
```D
import std;
void main()
{
string word = "Привет";
dchar[] line3 = to!(dchar[])(word.dup) // make a copy to get a
range of mutable char
01.05.2020 15:29, Steven Schveighoffer пишет:
Don't do this, use to!(dchar[]) as you have above. This will create
incorrect dchars for non-ascii text.
-Steve
Argh, as always you're right. Funny that I never did that and sadly that
I posted wrong code. Thank you, Steven, for correction of
01.05.2020 10:38, Chris Katko пишет:
I'm making anagrams. According to the nextPermutation() docs, I need to
'sort by less' to get all permutations. ... Except the doc page doesn't
mention how to do that, nor does std.algorithm.sort show how to sort a
string. ... and the google results on the d
27.04.2020 18:28, data pulverizer пишет:
I'm probably not the first person to say this but. Isn't @trusted an odd
label to give unsafe functions and open to abuse by unscrupulous
programmers? It almost says "nothing to see, this here piece of code is
a-ok". Shouldn't it be explicitly labelled a
27.04.2020 06:38, Jon Degenhardt пишет:
Is there a better way to write this?
--Jon
I don't know a better way, I think you enlist all possible ways - get a
value using either `front` or special range member. I prefer the second
variant, I don't think it is less consistent with range paradigm
26.04.2020 11:06, mark пишет:
snipped
Sorry for offtopic, imho both Qt and Gtk are too complex in case of
virtual list/tree view. I think the reason is they are retained mode
gui. I gave up to use them for that and develop custom virtual tree view
that is easy in use and currently capable t
23.04.2020 14:01, Russel Winder пишет:
Hi,
I need to start a process before the tests run, and terminate it after
the tests run. A module with a shared static constructor and shared
static destructor sounds like the way of doing this since the
constructor is run before main and the destructor af
23.04.2020 14:41, drug пишет:
terminate it after in ``
terminate it after in `shutdown()`
Is it true that user defined types are resolved to ScopeDsymbol and
basic types aren't?
On 3/23/20 2:14 PM, Steven Schveighoffer wrote:
E.g. https://dlang.org/dmd-osx.html#switch-release
There are also other switches like -boundscheck and -check. It’s
possible you have some library or project that is causing the behavior.
-Steve
Thank you, Steve.
In my case I guess it was my
Before I lived in assurance that asserts are actual only in debug mode
and in release mode they are nothing (except `assert(0)`). But today my
whole life is going sour because I stumbled upon assert in release mode
and of course that assert is failing.
This doc https://dlang.org/spec/expressio
On 3/16/20 12:24 PM, Ferhat Kurtulmuş wrote:
Ok, here is a solution. I opened my lib (yielded by my auxilary cpp)
using 7zip. There are two files containing symbol names, 1.txt and
2.txt. I searched for names of member functions. They were not there
because c++ compiler does not compile membe
On 3/16/20 10:11 AM, Ferhat Kurtulmuş wrote:
On Sunday, 15 March 2020 at 22:25:27 UTC, Arine wrote:
On Sunday, 15 March 2020 at 21:27:32 UTC, Ferhat Kurtulmuş
extern(C++, cv){
extern(C++, class) struct Size_(_Tp){
@disable this();
~this() { }
final _Tp area() const;
final dou
15.03.2020 23:53, Ferhat Kurtulmuş пишет:
I doubt it because in
https://dlang.org/spec/cpp_interface.html#using_cpp_classes_from_d
cpp code:
Derived *createInstance(int i)
d code:
extern (C++){
...
Derived createInstance(int i);
}
Ah, really, you use classes on D side.
15.03.2020 23:25, Ferhat Kurtulmuş пишет:
On Sunday, 15 March 2020 at 20:21:57 UTC, drug wrote:
15.03.2020 22:39, Ferhat Kurtulmuş пишет:
What is the D version of `createSizeIntWH`? In C++ it returns a
pointer but in D version it returns an instance.
extern(C++){
cv.Size_!int createS
15.03.2020 22:39, Ferhat Kurtulmuş пишет:
The original C++ class
https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/types.hpp#L315:
template class Size_
{
public:
typedef _Tp value_type;
//! default constructor
Size_();
Size_(_Tp _width, _Tp _h
1 - 100 of 389 matches
Mail list logo