On Thursday, 30 June 2016 at 17:08:45 UTC, Jonathan Marler wrote:
Is there a way to have an associative array of const values? I
thought it would have been:
const(T)[K] map;
map[x] = y;
but the second line gives Error: cannot modify const
expression. I would think that the const(T)[K] would
On Thursday, 30 June 2016 at 00:25:53 UTC, Jonathan Marler wrote:
I'd like to hear peoples thoughts on the various solutions for
the following problem. Say you have some hierarchy of classes
like:
class GameObject {
// ...
}
class Entity : GameObject {
// ...
}
class Player : Entity {
/
On Thursday, 19 May 2016 at 20:44:54 UTC, ciechowoj wrote:
Is there D equivalent of C++'s mutable keyword? Like the one
that allows to modify a field of struct from constant method.
Or some alternative solution?
There isn't an equivalent of mutable keyword because D const
differs from C++ con
On Thursday, 21 April 2016 at 17:27:09 UTC, Alex wrote:
Ok. So, does this mean, that they just allocate on
creation/binding them? If so, there is no problem and there are
no questions any more.
Just like classes - when closure expression is executed.
I have an unusual caption... On creation I
On Thursday, 21 April 2016 at 15:22:15 UTC, Alex wrote:
Hi all!
timing my program with valgrind/cachegrind and using -vgc
option of the compiler found the message:
"using closure causes GC allocation"
The question is:
does the usage of the closure causes the GC allocation on every
usage of th
On Monday, 28 March 2016 at 21:01:19 UTC, cy wrote:
I finally found the null pointer. It took a week. I was
assigning "db = db" when I should have been assigning "this.db
= db". Terrible, I know. But...
I invoked db.find_chapter.bindAll(8,4), when db was a null
pointer. There was no null poin
On Wednesday, 16 March 2016 at 11:18:36 UTC, Johan Engelen wrote:
Hi all,
I've found discussions, but not an actual "recommended"
solution for the problem of "statement is not reachable"
warnings in templates with early returns, e.g.:
```
bool nobool(T...)() {
foreach (i, U; T) {
On Wednesday, 16 March 2016 at 17:08:20 UTC, Johan Engelen wrote:
On Wednesday, 16 March 2016 at 11:47:35 UTC, QAston wrote:
import std.meta;
template isBool(U)() = is(U == bool);
static if (!allSatisfy!(isBool, T)) {
return true; // no longer emits a warning
}
Something like this should
On Friday, 21 June 2013 at 14:08:43 UTC, Sergei Nosov wrote:
Hi!
I've been thinking about how alias template parameters work and
I'm really confused =)
It makes perfect sense for literals, names, etc. But what I
can't get is how does it work for delegates.
If I have a function
auto apply(a
On Wednesday, 20 January 2016 at 14:01:23 UTC, QAston wrote:
To me this suggests that the dispatch by templated interface
type Visitor!(RETURN) doesn't work. IMO the order of interfaces
shouldn't matter here and the code should simply work.
Any ideas?
I'm on 2069.2 and when i remove one of t
Hi,
I have the following code:
interface Visitable(RETURN) {
RETURN accept(Visitor!RETURN);
}
interface Exp : Visitable!string, Visitable!int {
}
interface Visitor(RETURN) {
RETURN visitLit(Lit e);
RETURN visitAdd(Add e);
}
class Lit : Exp {
int val;
On Wednesday, 20 January 2016 at 00:50:49 UTC, Ali Çehreli wrote:
On 01/19/2016 04:22 PM, QAston wrote:
[...]
Is this it? If so, is it already in std.functional? (I could
not find it. :) )
auto appendMapped(alias f, R, T)(R r, T elem) {
r ~= f(elem);
return r;
}
int minus(int i) {
On Wednesday, 20 January 2016 at 00:12:16 UTC, Ali Çehreli wrote:
On 01/19/2016 03:37 PM, QAston wrote:
Hi,
I have the following code:
auto appendMapped(alias f, R, T)(R r, T elem) {
r ~= f(elem);
return r;
}
int minus(int i) {
return -i;
}
unittest {
int[] ar;
/
Hi,
I have the following code:
auto appendMapped(alias f, R, T)(R r, T elem) {
r ~= f(elem);
return r;
}
int minus(int i) {
return -i;
}
unittest {
int[] ar;
// here I do partial application of minus function
alias appendMinus(S,T) = appendMapped
On Friday, 14 August 2015 at 09:21:56 UTC, DarthCthulhu wrote:
I only want to access the logger object when the program is
compiled with the -debug option, so I don't want to pass it
along to the object constructor or set a member as a reference
to it (which is both tedious and pointless if not
On Sunday, 2 August 2015 at 10:04:54 UTC, nikolai wrote:
Yes, I was so excited about Dlang that i forgot to paste the
error:
Here's the link to imagescreen http://prntscr.com/7zwe6h
Can't help you with your problem, but I have another tip:
Shift-right-click inside a dir-> open cmd window here
On Monday, 3 August 2015 at 21:32:05 UTC, DLearner wrote:
Looks like 0-base is fixed, to avoid problems with existing
code.
But nothing stops _adding_ to the language by allowing
int[x:y] foo to mean valid symbols are foo[x], foo[x+1],...,
foo[y].
Plus rule that int[:y] means valid symbols are
On Saturday, 1 August 2015 at 23:02:51 UTC, bachmeier wrote:
But what type of programming are you doing? Even after decades
of programming and trying out dozens of languages, zero-based
indexing still gets me at times when the arrays I work with
represent vectors and matrices. Especially when p
On Thursday, 16 July 2015 at 07:43:10 UTC, Jonathan M Davis wrote:
[...]
On linux you can alter the limit by using ulimit command. -a
option shows the current limits.
On Sunday, 3 May 2015 at 17:35:42 UTC, Dennis Ritchie wrote:
Hi,
How can I rewrite this code to the D?
-
#include
#include
class A {
public:
std::string a() {
return std::string("foo");
}
};
class B {
public:
std::string b(){
return std::string(
20 matches
Mail list logo