On Thursday, 8 June 2017 at 17:39:41 UTC, Ivan Kazmenko wrote:
Reported: https://issues.dlang.org/show_bug.cgi?id=17481
Thank You!
Hi,
I'm kinda new to the D language and I love it already. :D So far
I haven't got any serious problems but this one seems like beyond
me.
import std.stdio;
void main(){
foreach(i; 0..2000){
writeln(i);
auto st = new ubyte[500_000_000];
destroy(st); //<-this
Thanks for the answer!
But hey, the GC knows that is should not search for any pointers
in those large blocks.
And the buffer is full of 0-s at the start, so there can't be any
'false pointers' in it. And I think the GC will not search in it
either.
The only reference to the buffer is 'st'
Jordan Wilson wrote:
This I think achieves the spirit of your code, but without the
memory exception:
ubyte[] st;
foreach(i; 0..2000){
writeln(i);
st.length=500_000_000; // auto = new ubyte[500_000_000];
st.length=0; // destory(st)
st.assumeSafeAppend;
//
On Thursday, 8 June 2017 at 10:48:41 UTC, ketmar wrote:
worksforme with -O, and with -O -inline.
I forgot to mention, that I'm generating win32 output.
DMD32 D Compiler v2.074.0
Hi,
This code works well with the unoptimized compilation with DMD.
import std.array;
synchronized class Obj{
private int[] arr;
void trigger(){ arr.length += 1; }
}
void main(){
auto k = new shared Obj;
k.trigger;
}
And when I use the -O option, it shows the following error in the
I've managed to narrow the problem even more:
//win32 dmd -O
class Obj{
synchronized void trigger(){ new ubyte[1]; }
}
void main(){
auto k = new shared Obj;
k.trigger;
}
This time I got a more sophisticated error message:
object.Error@(0): Access Violation
0x7272456D
On Friday, 8 June 2018 at 02:44:13 UTC, Mike Parker wrote:
...you can get it with this:
dmd -m64 -L/SUBSYSTEM:console -L/ENTRY:WinMainCRTStartup foo.d
Thank You! It works with LDC -m64 as well.
And now that I repaired my VCRedist2015 the bat file test (my
second code example) is working too.
On Friday, 8 June 2018 at 03:08:21 UTC, Mike Franklin wrote:
I recall similar issues with a project I was working on, but I
don't remember all the details now. Anyway, I ended up with
this in the end.
Using main() instead of WinMain() did the trick too. Also it's
simpler, so I choose this
Hi,
The following narrow test program works fine when compiled with
DMD to 32bit target:
import std.stdio, core.sys.windows.windows, core.runtime;
extern(Windows) int WinMain(HINSTANCE hInstance, HINSTANCE
hPrevInstance, LPSTR lpCmdLine, int iCmdShow)
{
Runtime.initialize;
On Thursday, 7 June 2018 at 19:42:05 UTC, Steven Schveighoffer
wrote:
Are you just compiling the 32-bit dmd version with default
flags?
Yes, no flags at all and it defaults to a 32bit target. I can use
the console and able to make windows, and able to setup an opengl
window too.
The console
On Thursday, 7 June 2018 at 23:25:45 UTC, Steven Schveighoffer
wrote:
...
The WinMain exported function works alone well and on 32bit it
also does the console.
On 64 I also tried AllocConsole, but fail. I get the Console
handle with GetConsoleHandle, it sends back a nonzero value.
But as I
Thank You for fast help! I just reply late because I wanted to
try out many things.
With Benjamin's list it was indeed easy to set up the environment.
I also installed LDC and it worked without problems too.
Made some tests about sse vectorization and it turned out that
I'm in love with LDC
Hello,
I'm very well satisfied with the DMD 32bit compiler and the
OptLink linker on Windows. I even made an incremental builder to
it, and I can see the running program in 1 second.
Lately I sadly noticed, that the OptLink works only for 32bit
target, and I need to go to 64bit if I want to
Now I have my first DMD 64bit windows console app running. (And
I'm already afraid of the upcoming windowed application haha)
After further fiddling I installed the >>>Visual Cpp tools
2015<<< package that contains a linker with x64 stuff in it
(along with several GB of bloatware).
contents
Hello,
I've already found out how to create an array with uninitialized
elements, but what I'm looking for is a way to append 16
uninitialized ushorts to it and after I will it directly from 2
SSE registers.
The approximate array length is known at the start so I could be
able to do this
Thank You!
On Wednesday, 21 March 2018 at 18:50:18 UTC, Adam D. Ruppe wrote:
On Wednesday, 21 March 2018 at 18:44:12 UTC, realhet wrote:
Compiling this I get an error: "formattedRead: cannot deduce
arguments from (string, string, float, float, float)"
What compiler version are you using? The newest
Hi,
I just got this problem and since an hour can't find answer to it.
float x,y,z;
if(formattedRead("vertex -5.1 2.4 3.666".strip, "vertex %f
%f %f", x, y, z)){
writefln("v(%f, %f, %f)", x, y, z);
}
Compiling this I get an error: "formattedRead: cannot deduce
arguments from
Hi,
Just a little weird thing I noticed and don't know why it is:
I have a FilePath struct and I wanted to make it work with the
"~" operator and an additional string.
So I've created a global funct:
FilePath opBinary(string op:"~")(FilePath p1, string p2){
return FilePath(p1, p2);
Thanks, this make it clear.
(This also explains the existence of opBinaryRight)
On Wednesday, 28 November 2018 at 21:58:16 UTC, kinke wrote:
You're not using naked asm; this entails a prologue (spilling
the params to stack etc.). Additionally, LDC doesn't really
like accessing params and locals in DMD-style inline asm, see
Hi,
Is there a documentation about the win64 calling convention used
with LDC2 compiler?
So far I try to use the Microsoft x64 calling convention, but I'm
not sure if that's the one I have to. But it's not too accurate
becaues I think it uses the stack only.
Thank You for the explanation!
But my tests has different results:
void* SSE_sobelRow(ubyte* src, ubyte* dst, size_t srcStride){ asm{
push RDI;
mov RAX, 0; mov RDX, 0; mov RCX, 0; //clear 'parameter'
registers
mov RAX, src;
mov RDI, dst;
//gen
movups XMM0,[RAX];
movaps
Hi,
I'm writing a picture browser program and I'd like to ask for a
bit of assistance.
My app is basically a Win32 window with an OpenGL surface.
Currently I'm able to display a lot of pictures in it. The
decompression of the bitmaps take place at the beginning of the
program.
I want to
On Wednesday, 3 April 2019 at 04:09:45 UTC, DanielG wrote:
My understanding is that there's no benefit to creating more
than the number of hyperthreads your CPU
Yes.
I'm just searching for a higher abstraction to manage this easily
in D. I've already did it years ago on Delphi. (-> Manage N
Hi, I'm googling since an hour but this is too much for me:
class A{}
class B:A{}
void foo(...){
if(_arguments[0]==typeid(A)){
//obviously not works for B
}
if(_arguments[0] is_a_descendant_of A){
//how to make it work for both A and B?
}
}
Hi again,
I'm trying to do variadic parameter processing, and I have the
following function that works fine:
static bool same(T1, T2)(){
pragma(msg, "same? "~T1.stringof~" "~T2.stringof);
return is(immutable(T1)==immutable(T2));
}
Btn btn(T...)(string params, T args){
enum
On Saturday, 8 June 2019 at 21:25:41 UTC, Adam D. Ruppe wrote:
On Saturday, 8 June 2019 at 21:24:53 UTC, Adam D. Ruppe wrote:
_arguments is a compile time construct, it is a run time thing.
err i meant is *NOT* a compile time construct
Thank You for the fast help!
At first I was happy to
On Tuesday, 11 June 2019 at 13:22:26 UTC, Adam D. Ruppe wrote:
On Tuesday, 11 June 2019 at 09:26:56 UTC, realhet wrote:
static bool processId(bool captureIntId, alias r, alias a)(){
mixin("alias ta = typeof("~a.stringof~");");
As I have been saying a lot, mixin and stringof should
On Saturday, 3 August 2019 at 05:33:05 UTC, Jonathan M Davis
wrote:
On Friday, August 2, 2019 5:13:10 PM MDT realhet via
Digitalmars-d-learn wrote:
Hi,
...
Thank you!
Now I have 2 solutions in mind:
1. If I only want to track the count and totalBytes for a
specific kind of reference, I
Hi,
I tried to make some resource statistict for my OpenGL Buffer
objects:
//here are the things that hold the statistics.
private __gshared{ size_t[int] textureSizeMap, bufferSizeMap; }
struct GLCounters{
int programs, shaders, textures, buffers;
size_t textureSize, bufferSize;
}
Hi,
I'm trying to use a popular function name "max", and extend it
for my special types:
For example:
module utils;
MyType max(in MyType a, in MyType a){...} //static function
struct V3f{
V3f max(in V2f b){...} //member function
}
module gl3n;
vec3 max(in vec3 a, in vec3 a) //another
On Friday, 6 December 2019 at 13:04:57 UTC, Ferhat Kurtulmuş
wrote:
On Friday, 6 December 2019 at 12:34:17 UTC, realhet wrote:
Hi,
I'm trying to use a popular function name "max", and extend it
for my special types:
For example:
module utils;
MyType max(in MyType a, in MyType a){...}
On Friday, 6 December 2019 at 14:55:18 UTC, Ferhat Kurtulmuş
wrote:
On Friday, 6 December 2019 at 13:25:24 UTC, realhet wrote:
On Friday, 6 December 2019 at 13:04:57 UTC, Ferhat Kurtulmuş
wrote:
[...]
Thx for answering!
[...]
In d you can also use scoped imports:
Hi,
I have an input range.
I use the map! on it to transform using a function.
Finally I use filter! on the transformed data.
When I do a foreach on this, i noticed, that the transform
function is called twice for each element.
If I remove the filter! it does only one transform function call
On Friday, 29 November 2019 at 15:30:22 UTC, realhet wrote:
...
Unfortunately function purity is not the answer.
I put a very long calculation into the transform function which
is called from "map!".
And the "filter!" is making the "map!" call my function 2 times:
First for the "filter!" to
On Friday, 29 November 2019 at 15:49:24 UTC, Paul Backus wrote:
It's actually a much simpler reason: filter calls .front twice
for each element in its input (once to check if the value
satisfies the predicate, and then again to return the value if
it does), and the range returned by map
On Sunday, 9 February 2020 at 00:27:21 UTC, Adam D. Ruppe wrote:
On Saturday, 8 February 2020 at 23:37:56 UTC, realhet wrote:
classinfo.m_init can be an option, but maybe there's a nicer
way to do this?
eh the initializer i think is the best. you can sometimes
shortcut it
pragma(msg, (new
On Sunday, 9 February 2020 at 00:41:12 UTC, realhet wrote:
On Sunday, 9 February 2020 at 00:27:21 UTC, Adam D. Ruppe wrote:
Using what I've learned:
class A{
int i=42;
void init(){ // reInitialize class fields
alias T = typeof(this);
mixin([FieldNameTuple!T].map!(n => n~"=(new
Hello,
class A{
int i = 42;
}
Is there a way to get that 42? (Input is the class A and the name
of the field 'i')
A.i.init returns 0, so it doesn't care about the class.
classinfo.m_init can be an option, but maybe there's a nicer way
to do this?
Thx!
On Sunday, 9 February 2020 at 00:15:47 UTC, Drug wrote:
On Saturday, 8 February 2020 at 23:37:56 UTC, realhet wrote:
Hello,
class A{
int i = 42;
}
Is there a way to get that 42? (Input is the class A and the
name of the field 'i')
A.i.init returns 0, so it doesn't care about the class.
On Sunday, 9 February 2020 at 01:19:55 UTC, Paul Backus wrote:
On Sunday, 9 February 2020 at 00:57:05 UTC, realhet wrote:
On Sunday, 9 February 2020 at 00:41:12 UTC, realhet wrote:
On Sunday, 9 February 2020 at 00:27:21 UTC, Adam D. Ruppe
enum initValue = (new
On Sunday, 9 February 2020 at 00:57:05 UTC, realhet wrote:
On Sunday, 9 February 2020 at 00:41:12 UTC, realhet wrote:
On Sunday, 9 February 2020 at 00:27:21 UTC, Adam D. Ruppe
wrote:
mixin([FieldNameTuple!T].map!(n => n~"=(new T)."~n~";").join);
After checking it in the asm debugger, it
On Sunday, 9 February 2020 at 02:25:56 UTC, Steven Schveighoffer
wrote:
On 2/8/20 7:39 PM, realhet wrote:
On Sunday, 9 February 2020 at 00:15:47 UTC, Drug wrote:
On Saturday, 8 February 2020 at 23:37:56 UTC, realhet wrote:
Yea, I exactly ran into that "init" problem, I will avoid that,
thx!
Hello,
I'm try to figure out the contents od the base class instance in
D, LDC Windows 64bit.
I'm sure that there is a 8 byte VMT pointer.
But unable to fund information about the remaining 8 byte. I
guess it must be a unique 8byte (void* ?) identifier that is
useful for Monitor. In a video
On Thursday, 16 January 2020 at 14:32:24 UTC, Adam D. Ruppe wrote:
On Thursday, 16 January 2020 at 14:30:04 UTC, realhet wrote:
Is there a documentation about that 'magic' field?
I'm pretty sure the only fields in there are pointer to vtable
and pointer to monitor object...
I have a really
Hello, anyone can help me make this better?
The functionality I want to achieve is: While serializing the
fields of a struct, I want it to check the @STORED UDA on every
field. If there is no fields are marked with @STORED, that means
every field must be serialized. Otherwise only the marked
On Sunday, 12 April 2020 at 12:42:40 UTC, Harry Gillanders wrote:
On Sunday, 12 April 2020 at 11:17:39 UTC, realhet wrote:
I only remembered the __traits(identifier...), but completely
forgot about the getMember.
And I never heard of anySatisfy.
My JSON serializer is beautiful now.
Thank
Hi,
import std.stdio, std.exception;
void main(){
class C{
void foo(){ writeln(123); }
}
C c;
try{
writeln(1);
c.foo;// access violation here
writeln(2);
}catch(Throwable t){
writeln("exception");
}
writeln(3);
}
When I run this code (using LDC2 64bit
On Thursday, 26 March 2020 at 14:52:36 UTC, Ferhat Kurtulmuş
wrote:
On Sunday, 22 March 2020 at 18:43:50 UTC, realhet wrote:
Hello,
I'm try to use the latest LDC2 version: 1.20.0
Previously I used 1.6.0
[...]
Try to run the compiler in visual studio command line terminal.
I set up the
On Tuesday, 24 March 2020 at 15:22:19 UTC, Steven Schveighoffer
wrote:
On 3/24/20 10:28 AM, realhet wrote:
On Sunday, 22 March 2020 at 20:20:17 UTC, Steven Schveighoffer
If this were Linux, I'd start using nm to search the object
files for the symbol that is missing (like search for symbols
Hello,
Is there a way to the following thing in a class instead of a
struct?
--
static struct Point
{
int x, y;
void toString(W)(ref W writer, scope const ref
FormatSpec!char f)
if (isOutputRange!(W, char))
{
//
Hello,
I'm try to use the latest LDC2 version: 1.20.0
Previously I used 1.6.0
After fixing all the compiler errors and warnings, I managed to
compile all the d source files to obj files, and I got 4 linking
errors. I think all of them caused by the first 2:
1:
msvcrt.lib(initializers.obj) :
On Sunday, 22 March 2020 at 20:20:17 UTC, Steven Schveighoffer
wrote:
Make sure you don't have any stale objects left over in your
project from the older build. Build everything clean from
scratch.
-Steve
Thx, I double checked this. Then I attempted to link from the
commandline and it
On Sunday, 22 March 2020 at 20:20:17 UTC, Steven Schveighoffer
wrote:
Make sure you don't have any stale objects left over in your
project from the older build. Build everything clean from
scratch.
-Steve
After narrowing the problem, I fixed all warnings, and
deprecations, and I have only
On Tuesday, 24 March 2020 at 15:22:19 UTC, Steven Schveighoffer
wrote:
On 3/24/20 10:28 AM, realhet wrote:
On Sunday, 22 March 2020 at 20:20:17 UTC, Steven Schveighoffer
I managed to compile it with normal compilation.
The -allInst flag may be the problem.
I also had success by manual
On Tuesday, 24 March 2020 at 16:35:56 UTC, realhet wrote:
On Tuesday, 24 March 2020 at 15:22:19 UTC, Steven Schveighoffer
wrote:
On 3/24/20 10:28 AM, realhet wrote:
On Sunday, 22 March 2020 at 20:20:17 UTC, Steven Schveighoffer
Now I have 2 of this:
megatexturing.obj : error LNK2019:
Hi,
I was able to reach all the fields in a subclass using foreach
and BaseClassesTuple, but is there a way to do this using
functional programming primitives, but in compile time for tuples?
private template FieldNameTuple2(T) {
enum FieldNameTuple2 = BaseClassesTuple!T.map!(S =>
On Thursday, 14 May 2020 at 19:01:25 UTC, H. S. Teoh wrote:
On Wed, May 13, 2020 at 12:26:21PM +, realhet via
Digitalmars-d-learn wrote:
Thank You, very helpful!
Hi,
Is there a way to make this in a nicer way without the string
mixin?
private auto generateVector(CT, alias fun, T...)(in T args){
static if(anyVector!T){
Vector!(CT, CommonVectorLength!T) res;
static foreach(i; 0..res.length) res[i] = mixin("fun(",
T.length.iota.map!(j =>
Hi,
struct S{int a, b, c=9, d, e, f;}
Is there a way or a trick to declare an UDA by using a nice
struct initializer?
It would be nice to be able to use the form:
@S{f:42} int a; //or something similar to this.
instead of this longer and error-prone way:
@S(0, 0, 0, 9, 0, 42) int
On Thursday, 17 September 2020 at 04:01:11 UTC, Adam D. Ruppe
wrote:
On Thursday, 17 September 2020 at 03:06:45 UTC, realhet wrote:
Anyone can help me telling how to decode these please?
Just prepend
_D4name
Thank you very much!
On Sunday, 27 September 2020 at 11:59:49 UTC, Anonymouse wrote:
On Sunday, 27 September 2020 at 10:17:39 UTC, realhet wrote:
On Saturday, 26 September 2020 at 17:13:17 UTC, Anonymouse
wrote:
On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote:
That looks the closes to the python
On Saturday, 26 September 2020 at 17:13:17 UTC, Anonymouse wrote:
On Saturday, 26 September 2020 at 16:05:58 UTC, realhet wrote:
The closest I can get is @(S.init.c(9).f(42)) with use of
opDispatch, which is easier to read but still ugly.
All I can get is that the
- an identifier of a member
On Saturday, 3 October 2020 at 14:00:30 UTC, Adam D. Ruppe wrote:
On Saturday, 3 October 2020 at 13:10:31 UTC, realhet wrote:
I only managed to get the string[] by making a static foreach,
but I don't know how to put that in an enum xxx = ...;
statement.
There's always other ways but general
Hi,
class Printer{
@("NODES") int gem1, gem2, gem3, gem4, gem5, head1, head2,
head3, head4;
import std.traits, std.meta;
alias Nodes = getSymbolsByUDA!(typeof(this), "NODES");
enum NodeNames = ["gem1", "gem2", ];
}
Is there a way to make an enum like the above with compile time
Hello,
I have a 2 level nested struct structure with nice descriptive
field names.
And I thought it will be easy to alias those identifierLists with
a few letter names and do some calculations on them.
But I'm having an error.
struct A{
struct B{ int c; }
B b;
auto f(){
alias d =
On Wednesday, 20 May 2020 at 09:03:51 UTC, 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:
With this mod it also works with structs:
template AllClasses(T){
static if(is(T == class))
alias
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);
class A { int a, a1; }
class
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
mixin("@property auto ", k, "() const { return ", v, "; }");
Wow, string mixin can process comma separated list, I gotta
remember this, thanks!
On Tuesday, 2 June 2020 at 13:37:25 UTC, Stanislav Blinov wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
Try UDAs instead of a map:
struct A {
struct G {
@("hauteur") int height;
}
Good idea, thx! I already using UDA's for range and measurement
units.
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
On Tuesday, 2 June 2020 at 09:10:03 UTC, Ali Çehreli wrote:
On 6/2/20 1:56 AM, realhet wrote:
Oh and I can put that function generator mixin thing into a
template as well, that way it is reusable and much nicer.
There are a lot of
On Tuesday, 2 June 2020 at 09:10:03 UTC, Ali Çehreli wrote:
On 6/2/20 1:56 AM, realhet wrote:
> struct A{
>struct B{ int c; }
>B b;
>
>auto f(){
> alias d = b.c;
The spec explicitly says it's not legal: "Aliases cannot be
used for expressions" (Item 10):
On Sunday, 20 September 2020 at 14:54:09 UTC, Steven
Schveighoffer wrote:
On 9/20/20 9:30 AM, realhet wrote:
ref inout(int) x() inout { return array[0]; }
This doesn't work when I type:
v.x++;
I want to make a similar type like the GLSL vectors. Where the
following thing is valid:
vec4 a,
On Sunday, 20 September 2020 at 17:08:49 UTC, realhet wrote:
On Sunday, 20 September 2020 at 16:18:19 UTC, Steven
Schveighoffer wrote:
On 9/20/20 11:52 AM, realhet wrote:
On Sunday, 20 September 2020 at 14:54:09 UTC, Steven
Schveighoffer wrote:
On 9/20/20 9:30 AM, realhet wrote:
Yeah, I
Hi,
struct S{
int[2] array;
ref x() { return array[0]; }
auto x() const { return array[0]; }
}
If there a way to write the function 'x' into one function, not 2
overloads.
I tried auto/const/ref mindlessly :D, also remembered 'inout',
but obviously those weren't solve the
On Sunday, 20 September 2020 at 13:30:36 UTC, realhet wrote:
Hi,
More specifically:
struct S{
int[2] array;
ref swizzle(string code)(){
static if(code=="x") return array[0];
else static if(code=="y") return array[1];
else static assert("Unhandled");
}
On Sunday, 20 September 2020 at 15:52:49 UTC, realhet wrote:
On Sunday, 20 September 2020 at 14:54:09 UTC, Steven
Schveighoffer wrote:
On 9/20/20 9:30 AM, realhet wrote:
I managed to do the constant swizzles and it seems so elegant:
auto opDispatch(string def)() const
On Sunday, 20 September 2020 at 16:18:19 UTC, Steven
Schveighoffer wrote:
On 9/20/20 11:52 AM, realhet wrote:
On Sunday, 20 September 2020 at 14:54:09 UTC, Steven
Schveighoffer wrote:
On 9/20/20 9:30 AM, realhet wrote:
Yeah, I think this might work.
-Steve
That would be a 3rd category out
Hello,
I'm trying to get information from the JsonFile produced by LDC2,
but having no clue how to decode this:
For example:
header: KeywordCat kwCatOf(int k)
"deco" : "FAyaZE3het8keywords10KeywordCat",
The "deco" field contains the full name of the return type
het.keywords.KeywordCat,
Hi,
I'd like to catch the OS Exceptions including:
- access violation
- int 3
- invalid opcode
etc.
The default behavior is that when these events happen, the
program immediately exits with some negative exit code.
It was not a problem on other systems like: MSVC or Delphi, but
on LDC
On Saturday, 4 July 2020 at 14:44:06 UTC, Kagamin wrote:
try
https://docs.microsoft.com/en-us/windows/win32/api/errhandlingapi/nf-errhandlingapi-setunhandledexceptionfilter
Thank You, this was the winner for me.
Not just I can catch the OS Exceptions, I can check and alter the
CPU state and
On Tuesday, 2 June 2020 at 20:38:40 UTC, Steven Schveighoffer
wrote:
On 6/2/20 10:51 AM, realhet wrote:
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
A month ago I discovered that mixinDeclarations can be used for
types
On Wednesday, 3 June 2020 at 10:11:59 UTC, realhet wrote:
On Tuesday, 2 June 2020 at 20:38:40 UTC, Steven Schveighoffer
wrote:
On 6/2/20 10:51 AM, realhet wrote:
On Tuesday, 2 June 2020 at 13:10:55 UTC, Paul Backus wrote:
On Tuesday, 2 June 2020 at 09:28:01 UTC, realhet wrote:
mixin("int[",
Hello, I have a problem I can't even understand with the code
below:
https://run.dlang.io/is/7yXAEA
import std.stdio, std.range, std.algorithm, std.traits, std.meta;
struct UNIFORM{ string name; }
struct A{
int i1;
@UNIFORM() int i2;
@UNIFORM("fuzz") int i3;
@UNIFORM int i4;
On Saturday, 13 June 2020 at 12:55:36 UTC, realhet wrote:
Hello, I have a problem I can't even understand with the code
For the first I realized that an UDA can be a type too, and come
up with this:
template getUDA(alias a, U){
enum u = q{ getUDAs!(a, U)[$-1] };
static if(hasUDA!(a,
Hi,
class A{
A parent;
A[] items;
void myDestroy(){
items.each!(i => i.myDestroy);
parent = null;
// after this point I think the GC will release it
automatically, and it will call ~this() too. Am I right?
}
}
I have a hierarchy of class instances forward and backward
On Monday, 30 November 2020 at 14:36:08 UTC, FeepingCreature
wrote:
On Monday, 30 November 2020 at 14:33:22 UTC, realhet wrote:
...
Though you may want to do `items = null;` too.
I just forgot 1 of three things, thx for pointing it out.
And I also forget to notify the parent to remove the
On Monday, 14 December 2020 at 14:16:41 UTC, Dukc wrote:
On Friday, 11 December 2020 at 19:07:23 UTC, realhet wrote:
I've just made this unicode wordreplacer function working, but
It seems not too nice and functional-ish.
Are there ways to make it more simple?
To answer the title, yes there
Hi,
I've just made this unicode wordreplacer function working, but It
seems not too nice and functional-ish.
Are there ways to make it more simple?
import std.stdio, std.range, std.algorithm, std.uni, std.utf,
std.conv;
bool isWordChar(dchar ch){
return isAlphaNum(ch) || ch=='_';
}
On Tuesday, 10 November 2020 at 01:00:50 UTC, Mark wrote:
Hi all,
my question would be about using D or not using D.
Here are some things you will NOT get in D:
youtube -> Dconf 2014 Day 2 Keynote: The Last Thing D Needs --
Scott Meyers
For example, you will not get neurosis from it, or
Hi,
I wan't to process every specialization of the BitFlags struct in
a function:
So far the best I can come up is this:
static void stdUI(F)(ref F flags)
if(F.stringof.startsWith("BitFlags!(")){}
But it's obviously lame.
If I try this way:
static void stdUI(E, U)(ref BitFlags!(E, U)
On Sunday, 31 January 2021 at 14:16:15 UTC, Paul Backus wrote:
On Sunday, 31 January 2021 at 14:04:00 UTC, realhet wrote:
Hi,
static void stdUI(E, Flag!"unsafe" u)(ref BitFlags!(E, u)
flags) {}
Thank You!
Somehow I forgot I could pass amd match ANY TYPE in the template
parameters.
On Sunday, 30 May 2021 at 12:16:19 UTC, realhet wrote:
presets.keys.sort.take(1).get(0); <-
Oups: after fixing an error and making it compile the solution is
even uglier:
presets.keys.sort.take(1).array.get(0);
Hello,
This is my current solution but there must be a better way to do
it in D
T get(T)(T[] arr, size_t idx, T def = T.init){
return idx
Hi,
I wanted to make a container class that exposes its elements
using a simple "alias this", but getting weird errors:
I test with the std.algorithm.filter template function.
1. when I use "alias this" on a function that returns a slice,
making the internal array unreachable, filter just
On Wednesday, 7 July 2021 at 17:10:01 UTC, Paul Backus wrote:
On Wednesday, 7 July 2021 at 16:20:29 UTC, realhet wrote:
int[] opIndex() { return array; }
Thx, I didn't know about this type of opSlice override. It works
nicely.
Now I have these choices:
- write [] everywhere to access
On Wednesday, 21 April 2021 at 15:53:59 UTC, Ali Çehreli wrote:
On 4/21/21 8:37 AM, realhet wrote:
On Wednesday, 21 April 2021 at 10:47:08 UTC, Mike Parker wrote:
On Wednesday, 21 April 2021 at 10:00:51 UTC, realhet wrote:
It has access to the context of its enclosing scope (via an
added
Hi
What am I doing wrong here?
import std.stdio, std.range, std.algorithm, std.uni, std.utf,
std.conv, std.typecons, std.array;
auto SE(A, B)(in A a, in B b){
return (a-b)^^2;
}
void main(){
auto a = [1, 2, 3], b = [1, 1, 1];
lockstep(a, b,
1 - 100 of 145 matches
Mail list logo