On Friday, 15 July 2016 at 12:05:47 UTC, ag0aep6g wrote:
On 07/15/2016 10:29 AM, maik klein wrote:
[...]
Sure. Just instantiate Rc with a const/immutable T. I.e., write
`Rc!(const int)` instead of `const Rc!int`. Or with auto and
makeRc: `auto rc = makeRc(immutable int(5));`.
[...]
When
There are two things that bothered me for quite some time
Interior immutability:
Consider a something like this
https://dpaste.dzfl.pl/fa5be84d26bc
The implementation is totally wrong and it doesn't make sense,
but it shows that Rc can not be const/immutable because at least
"dup" needs to i
I have my own version of Algebraic
struct Ok(T){
T value;
}
struct Err(E){
E value;
}
auto ok(T)(auto ref T value){
return Ok!T(value);
}
auto err(E)(auto ref E err){
return Err!E(err);
}
alias Result(T, E) = Algebraic!(Ok!T, Err!E);
I have a constructor and opAssign which al
On Thursday, 31 March 2016 at 00:06:19 UTC, maik klein wrote:
On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote:
On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin
wrote:
On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote:
I want to finally convert my project to w
On Wednesday, 30 March 2016 at 17:38:15 UTC, maik klein wrote:
On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin
wrote:
On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote:
I want to finally convert my project to windows. That means
that I want to build it on windows and linu
On Wednesday, 30 March 2016 at 12:46:08 UTC, Vadim Lopatin wrote:
On Wednesday, 30 March 2016 at 12:19:34 UTC, maik klein wrote:
I want to finally convert my project to windows. That means
that I want to build it on windows and linux.
The problem is that I have one external c library 'glfw'. I
I want to finally convert my project to windows. That means that
I want to build it on windows and linux.
The problem is that I have one external c library 'glfw'. I
thought that I would just link with it explicitly but actually I
am not completely sure how.
So I just added a submodule, clo
On Tuesday, 29 March 2016 at 21:27:15 UTC, ZombineDev wrote:
On Saturday, 26 March 2016 at 17:43:48 UTC, maik klein wrote:
On Saturday, 26 March 2016 at 17:06:39 UTC, ag0aep6g wrote:
On 26.03.2016 18:04, ag0aep6g wrote:
https://gist.github.com/aG0aep6G/a1b87df1ac5930870ffe/revisions
PS: Thos
On Saturday, 26 March 2016 at 17:06:39 UTC, ag0aep6g wrote:
On 26.03.2016 18:04, ag0aep6g wrote:
https://gist.github.com/aG0aep6G/a1b87df1ac5930870ffe/revisions
PS: Those enforces are for a size of 100_000 not 1_000_000,
because I'm impatient.
Thanks, okay that gives me more more reliable r
I recently wrote an article an SoA
https://maikklein.github.io/post/soa-d/
But now I wanted to actually benchmark SoA vs AoS and it is so
much harder than I thought.
In DMD SoA basically always beats AoS by a huge chuck. SoA is
always at least twice as fast compared to AoS.
But with LDC it
So this is mostly curiosity and not completely related to D but I
would like to know how a vtable is actually implemented. All the
explanations that I have seen so far are a bit vague and it would
be nice to actually see some code.
I tried to implement the following myself
interface Something
I wanted to implement a simple command queue in D. To give a bit
of context, I want to create a command queue for opengl. Instead
of interacting directly with opengl, you will create commands,
put them in a queue and then the renderer will read those
commands and execute the correct OpenGl call
I want to create a logger in a multithreaded system. I wanted to
expose a global variable like
logger.log("something");
I also wanted to reuse D's thread local global variables because
that would make it easy to log in a multithreaded system.
This is really easy to do, but the problem is tha
On Saturday, 20 February 2016 at 03:02:11 UTC, cym13 wrote:
On Saturday, 20 February 2016 at 02:26:56 UTC, maik klein wrote:
On Saturday, 20 February 2016 at 02:22:12 UTC, Ali Çehreli
wrote:
[...]
Your "Method B" is how I did it too but how do I convert it
back to a static array of float[2][
On Saturday, 20 February 2016 at 02:22:12 UTC, Ali Çehreli wrote:
On 02/19/2016 06:00 PM, maik klein wrote:
How would I transpose
float[3][2]
to
float[2][3]
with http://dlang.org/phobos/std_range.html#.transposed
Because static arrays are not ranges, they must be used as
slices with the
How would I transpose
float[3][2]
to
float[2][3]
with http://dlang.org/phobos/std_range.html#.transposed
On Tuesday, 16 February 2016 at 02:09:15 UTC, Matt Elkins wrote:
I've been bitten again by my lack of understanding of the D
struct lifecycle :-/. I managed to reduce my buggy program to
the following example:
[...]
In D you can always call Foo.init even with @disable this(), The
first 3 de
For example it is no problem in C++ to have
std::vector> vuf;
But how can this be expressed in D?
For example
Array!(Unique!int) ua;
doesn't compile because it requires this(this) which is obviously
disabled for "Unique".
On Sunday, 31 January 2016 at 20:20:52 UTC, Steven Schveighoffer
wrote:
On 1/31/16 3:15 PM, Matt Elkins wrote:
On Sunday, 31 January 2016 at 20:11:07 UTC, Matt Elkins wrote:
On Sunday, 31 January 2016 at 20:10:03 UTC, Matt Elkins wrote:
On Sunday, 31 January 2016 at 20:07:26 UTC, Steven
Schvei
I recently asked a question about ownership semantics in D
https://stackoverflow.com/questions/35115702/how-do-i-express-ownership-semantics-in-d
But a few minutes ago I found an answer on SO that could
potentially explain a lot.
http://stackoverflow.com/a/35114945/944430
Sadly it has some p
On Sunday, 31 January 2016 at 17:55:53 UTC, Matt Elkins wrote:
Errr, ignore the makeFoo() line. Left that in by accident, has
no bearing on the issue.
I have found an interesting SO answer
http://stackoverflow.com/a/35114945/944430
This would explain everything that we would need. I am just
On Sunday, 31 January 2016 at 17:42:19 UTC, anonymous wrote:
On 31.01.2016 18:21, Matt Elkins wrote:
I know I can mark an argument ref to require lvalues, so I'm
wondering
whether there is an equivalent for rvalues; that is, is there
a way to
specify that an argument to a function MUST be an r
On Sunday, 31 January 2016 at 17:21:54 UTC, Matt Elkins wrote:
I know I can mark an argument ref to require lvalues, so I'm
wondering whether there is an equivalent for rvalues; that is,
is there a way to specify that an argument to a function MUST
be an rvalue?
For example, in C++ I can do t
On Tuesday, 26 January 2016 at 03:03:40 UTC, Igor wrote:
Is there a GC-less array that we can use out of the box or do I
have to create my own?
https://dlang.org/phobos/std_container_array.html
I have also asked this question here
https://stackoverflow.com/questions/34838742/weak-references-or-pointers
But I try to word it differently.
I have a game with GameObjects, a system manages those
GameObjects. GameObjects can hold a pointer/reference to each
other.
But at one point a Game
On Wednesday, 18 November 2015 at 17:22:52 UTC, Meta wrote:
On Wednesday, 18 November 2015 at 12:20:42 UTC, maik klein
wrote:
[...]
Which version of the compiler are you using?
Linux - DMD64 D Compiler v2.069.0
On Wednesday, 18 November 2015 at 13:51:59 UTC, John Colvin wrote:
On Wednesday, 18 November 2015 at 12:20:42 UTC, maik klein
wrote:
[...]
I think this is a bug, please report it at issues.dlang.org and
perhaps there will be an explanation or it will be fixed.
In the mean time, something lik
https://stackoverflow.com/questions/33779822/unable-to-call-each-on-a-lockstep-range-containing-2-or-more-ranges
http://dpaste.dzfl.pl/76c79f1f12ab
void main(){
import std.container;
import std.stdio;
import std.algorithm.iteration;
import std.range;
Array!int ai = [1,2,3,4];
Array!i
On Tuesday, 17 November 2015 at 15:48:10 UTC, anonymous wrote:
On 17.11.2015 15:32, maik klein wrote:
[...]
[snip]
I don't quite understand how that code is supposed to work.
Maybe there's just some detail missing, but it could also be
that your approach can't work.
[...]
Thanks but I ha
The question is also posted on
https://stackoverflow.com/questions/33757981/filtering-a-tuple-of-containers-with-indicies
template tupIndexToRange(alias Tup, Indices...){
import std.meta;
static if(Indicies.length == 0){
alias tupIndexToRange = AliasSeq!();
}
else{
alias tupInde
template IsSame(T){
template As(alias t){
enum As = is(T : typeof(t));
}
}
void main()
{
int i;
enum b = IsSame!int.As!(i);
}
Err:
Error: template instance As!(i) cannot use local 'i' as parameter
to non-global template As(alias t) dmd failed with exit code 1
I don't understand the
On Wednesday, 4 November 2015 at 06:20:30 UTC, Jakob Ovrum wrote:
On Tuesday, 3 November 2015 at 23:41:10 UTC, maik klein wrote:
[...]
import std.algorithm.iteration : sum;
import std.meta : allSatisfy, Filter;
import std.traits;
import std.typecons : tuple;
import std.range : only;
// These
Is it possible to filter variadics for example if I would call
void printSumIntFloats(Ts...)(Ts ts){...}
printSumIntFloats(1,1.0f,2,2.0f);
I want to print the sum of all integers and the sum of all floats.
//Pseudo code
void printSumIntFloats(Ts...)(Ts ts){
auto sumOfInts = ts
On Sunday, 24 August 2014 at 21:51:39 UTC, Weaseldog wrote:
On Sunday, 24 August 2014 at 20:32:02 UTC, maik klein wrote:
Are there any exercises/challenges for D?
Something like this?
http://www.haskell.org/haskellwiki/99_questions/1_to_10
Well, you could port 99 lisp problems to D - D can b
Are there any exercises/challenges for D?
Something like this?
http://www.haskell.org/haskellwiki/99_questions/1_to_10
35 matches
Mail list logo