On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote:
I need to store a hetrogeneous array of delegates. How can I do
this but still call the function with the appropriate number of
parameters at run time?
I have the parameters as Variant[] params and a
function/delegate pointer(void*
On Sunday, 30 July 2017 at 09:12:53 UTC, piotrekg2 wrote:
I would like to learn more about GC in D. For example can
anyone explain why do we need memset(0) here:
https://github.com/dlang/phobos/blob/master/std/container/array.d#L356 , doesn't it assume a certain type of GC? What if there is a ne
On Sunday, 30 July 2017 at 08:18:07 UTC, Danni Coy wrote:
The following code is not working for me
float[3] f;
f[] = abs(f)[] * -1.0f;
where abs is a function that returns a float[3];
it complains that f should be attached to some memory.
Is it a bug or am I missing something?
I cannot repro
On Friday, 3 March 2017 at 18:09:02 UTC, Jonathan M. Wilbur wrote:
I have tried to come up with a good way to get the mantissa,
exponent, and base from a real number, and I just can't come up
with a good cross-platform way of doing it. I know about
std.math.frexp(), but that function only gives
You can utilize a little-known `switch` syntax trick in
combination with `foreach`. Because a `foreach` over tuples is
unrolled at compile time, it works even if your fields don't have
exactly the same types:
--
struct Foo {
int
On Saturday, 19 November 2016 at 20:24:09 UTC, Marduk wrote:
On Saturday, 19 November 2016 at 12:55:57 UTC, Marc Schütz
wrote:
On Saturday, 19 November 2016 at 11:11:36 UTC, Nordlöw wrote:
On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote:
The difference is that D is more verbose. Am
On Saturday, 19 November 2016 at 20:08:42 UTC, Marduk wrote:
On Saturday, 19 November 2016 at 11:11:36 UTC, Nordlöw wrote:
On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote:
The difference is that D is more verbose. Am I missing
something? Can we have C's behaviour in D?
Something l
On Saturday, 19 November 2016 at 11:11:36 UTC, Nordlöw wrote:
On Saturday, 19 November 2016 at 09:38:38 UTC, Marduk wrote:
The difference is that D is more verbose. Am I missing
something? Can we have C's behaviour in D?
Something like
auto I(T)(T im)
if (isNumeric!T)
{
return complex
On Friday, 28 October 2016 at 11:24:28 UTC, Alfred Newman wrote:
Hello,
I'm getting some troubles to replace the accented letters in a
given string with their unaccented counterparts.
Let's say I have the following input string "très élégant" and
I need to create a function to return just "t
On Tuesday, 18 October 2016 at 16:43:19 UTC, vino wrote:
On Wednesday, 12 October 2016 at 13:44:59 UTC, Erikvv wrote:
In your first post you mention it should be weighted, but I
see no weights anywhere.
Hi Marc,
I am at the initial stage of implementing the round robin
algorithm and still
On Wednesday, 12 October 2016 at 16:57:50 UTC, Meta wrote:
There's also a *very* ugly hack you can do:
//A template function's .stringof is of the format name>()()
//so match on the number of brackets to determine whether it's
a template function or not
enum isTemplateFunction = __traits(isTem
On Thursday, 13 October 2016 at 01:09:06 UTC, Ali Çehreli wrote:
On 10/10/2016 12:01 PM, Yuxuan Shui wrote:
Hi,
Why is there no opIndexDispatch for overloading a[x].func() ?
I could not understand the question fully but would using an
element proxy work?
I assume a proxy would indeed wor
On Monday, 10 October 2016 at 11:46:01 UTC, Nordlöw wrote:
At
https://github.com/nordlow/phobos-next/blob/master/src/moval.d
I've implemented a helper function for creating r-value out of
l-values defined as
E movedToRvalue(E)(ref E e)
{
import std.algorithm.mutation : move;
E value;
On Saturday, 8 October 2016 at 22:48:53 UTC, vino wrote:
Hi,
Can some one guide me on how to implement the weighted round
robin, below is what i tried or any other better ways to do it
Main Requirement : Incoming socket connection has to be sent to
3 servers in the weighted round robin fash
On Saturday, 1 October 2016 at 20:52:48 UTC, rcorre wrote:
I just tried to compile an old project and the following failed:
---
enum Paths : string {
bitmapDir = "content/image",
fontDir = "content/font",
soundDir = "content/sound",
...
if (Paths.preferences.exists)
...
On Tuesday, 27 September 2016 at 14:57:26 UTC, Dsciple wrote:
struct ConfigParams {
// ...
// Define configuration parameters' static default fields
static immutable BindAddresses defaultBindAddresses =
BindAddresses([
BindAddress("192.168.2.10")
]);
// ...
}
Yepp, that's defini
On Tuesday, 27 September 2016 at 09:04:53 UTC, Dsciple wrote:
As said, this works fine when tested in isolation, and the
compiler only complains when using BindAddress as a member of
ConfigParams.
Any idea what the problem may be?
Or is there maybe a ready to use, high-level library for
parsin
On Tuesday, 20 September 2016 at 04:17:21 UTC, crimaniak wrote:
Hi and thanks all!
On Tuesday, 20 September 2016 at 00:43:10 UTC, Jonathan M Davis
wrote:
immutable string executablePath;
shared static this()
{
import std.file : thisExePath();
executablePath = thisExePath();
}
This
On Tuesday, 13 September 2016 at 10:02:28 UTC, Andrea Fontana
wrote:
On Tuesday, 13 September 2016 at 09:46:46 UTC, Nordlöw wrote:
I would like to experiment with Fibers/Coroutines in D/vibe.d.
I'm missing a code example in std.concurrency that highlights
an example of using Fibers for massive
On Tuesday, 13 September 2016 at 09:46:46 UTC, Nordlöw wrote:
I would like to experiment with Fibers/Coroutines in D/vibe.d.
I'm missing a code example in std.concurrency that highlights
an example of using Fibers for massive concurrency. Could
anybody show me such a code example or link to a
On Friday, 15 July 2016 at 17:25:23 UTC, cy wrote:
On Monday, 20 June 2016 at 16:39:54 UTC, Marc Schütz wrote:
Untested:
Seems to only work if A and B are both defined in the same file
as Foos (defeating the purpose). Putting A and B in a.d and b.d
respectively gives me these errors:
a.d
On Sunday, 10 July 2016 at 07:20:29 UTC, Meta wrote:
On Friday, 8 July 2016 at 09:01:10 UTC, Marc Schütz wrote:
`foo()` is effectively a delegate, therefore `const` applies
to the context.
AFAIK const on a function can only ever refer to the `this`
pointer, but there is no `this` pointer
On Thursday, 7 July 2016 at 15:02:29 UTC, Jonathan M Davis wrote:
On Thursday, July 07, 2016 10:33:39 Basile B. via
Digitalmars-d-learn wrote:
this compiles without error:
struct Foo
{
int i;
void bar()
{
void foo() const
{
i = 1;
}
auto concat(T : E[n], E, size_t n)(const E[][] args...) @nogc
{
size_t offset = 0;
T result = void;
foreach(arr; args) {
result[offset .. offset+arr.length] = arr;
offset += arr.length;
}
assert(offset == result.length);
return result;
}
static immutable ub
On Tuesday, 21 June 2016 at 19:21:01 UTC, Gary Willoughby wrote:
Right ok, thanks! It doesn't seem to help though as the
compiler complains about it being not @nogc.
You probably need to declare the delegate and opApply() itself as
@nogc, too:
int opApply(scope int delegate(int) @nogc dg) @n
Untested:
// foo.d
import a, b;
mixin template Foos {
static if(is(typeof(this) == A))
void foo() { /* implementation for A */ }
static if(is(typeof(this) == B))
void foo() { /* implementation for B */ }
}
// a.d
import foo;
class A {
mixin Foos;
}
// b.d
import foo;
class B
On Tuesday, 7 June 2016 at 03:55:03 UTC, none wrote:
import std.algorithm.iteration : map;
import std.algorithm : castSwitch;
import std.format : format;
class A { int value; this(int value) { this.value = value; }}
interface I { }
class B : I { }
Object[] arr = [new A(5), new B
On Thursday, 2 June 2016 at 08:50:26 UTC, Jacob Carlborg wrote:
Is it intentional that a non-static opCall overrides the
default constructor of a struct?
struct Foo
{
int a;
void opCall(string b) { }
}
void main()
{
auto f = Foo(3); // line 14
f("asd");
}
The above code gives
On Monday, 30 May 2016 at 19:06:53 UTC, ArturG wrote:
does this count?
struct Foo
{
int x;
float f;
}
void main()
{
Foo foo;
if(foo is typeof(foo).init) "A: does'nt work".writeln;
foo = Foo();
if(foo is typeof(foo).init) "B: works".writeln;
}
This one is a bug in DMD.
On Sunday, 29 May 2016 at 07:18:10 UTC, Jonathan M Davis wrote:
On Friday, May 27, 2016 09:08:20 Marc Schütz via
Digitalmars-d-learn wrote:
On Thursday, 26 May 2016 at 06:23:17 UTC, Jonathan M Davis
wrote:
> The difference is that it's impossible to do
> 10.opBinary!"+&qu
On Thursday, 26 May 2016 at 16:45:22 UTC, ArturG wrote:
im just playing with this template[1] is there anything else i
missed? (if you dont mind)
it basically treats any T.init as false and skips the
function/delegate and just returns type.
[1] https://dpaste.dzfl.pl/d159d83e3167
If you just
On Thursday, 26 May 2016 at 22:47:02 UTC, Era Scarecrow wrote:
On Thursday, 26 May 2016 at 22:15:42 UTC, ag0aep6g wrote:
Sorry, I'm still lost. Why can't you do whatever you're doing
in opOpAssign directly there, or in a free function? Does the
pseudo-array contain any additional data? Would a
On Thursday, 26 May 2016 at 06:23:17 UTC, Jonathan M Davis wrote:
The difference is that it's impossible to do
10.opBinary!"+"(15), so if you're forced to do
foo.opBinary!"+"(bar) to get around a symbol conflict, it won't
work with built-in types.
Well, that begs the question: Why don't built
On Thursday, 26 May 2016 at 10:51:30 UTC, John Nixon wrote:
On Wednesday, 25 May 2016 at 15:44:34 UTC, Marc Schütz wrote:
On Tuesday, 24 May 2016 at 20:58:11 UTC, John Nixon wrote:
On Tuesday, 24 May 2016 at 15:17:37 UTC, Adam D. Ruppe wrote:
On Tuesday, 24 May 2016 at 14:29:53 UTC, John
On Tuesday, 24 May 2016 at 20:58:11 UTC, John Nixon wrote:
On Tuesday, 24 May 2016 at 15:17:37 UTC, Adam D. Ruppe wrote:
On Tuesday, 24 May 2016 at 14:29:53 UTC, John Nixon wrote:
This naively doesn’t seem right because the RHS of an
assignment should not be altered by it.
It's because the ch
On Sunday, 22 May 2016 at 09:42:54 UTC, Jack Applegame wrote:
I agree. But I think we need something that allows *logical*
const and immutable.
Strict binding constness to physical memory constancy is not
always necessary and sometimes even harmful.
http://wiki.dlang.org/DIP89
On Friday, 20 May 2016 at 15:07:53 UTC, chmike wrote:
The error message is gone, but I now have another compilation
error message I don't understand.
This is what I have in fact
interface Info { . . . }
class MyInfos {
. . .
protected:
class Obj : Info
{
. . .
}
public:
On Sunday, 15 May 2016 at 13:01:45 UTC, Michael wrote:
It may be that I'm doing something wrong here, but after
updating DMD to the latest version, my simulations started
producing some very odd results and I think I've pinpointed it
to a sign inversion that I was making. Here is some code from
On Tuesday, 10 May 2016 at 22:17:00 UTC, pineapple wrote:
On Tuesday, 10 May 2016 at 09:57:11 UTC, pineapple wrote:
On Monday, 9 May 2016 at 18:56:15 UTC, Peter Häggman wrote:
No problem here (tested with everything in a single module).
I can't help more.
Front end version ?
Well, this is th
On Monday, 2 May 2016 at 08:46:31 UTC, Ali Çehreli wrote:
On 05/01/2016 12:54 PM, Xinok wrote:
> On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote:
>> On 04/30/2016 10:05 PM, Joel wrote:
>> > This has no effect:
>> > _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0);
>> });
>>
>>
On Sunday, 1 May 2016 at 05:42:00 UTC, Ali Çehreli wrote:
On 04/30/2016 10:05 PM, Joel wrote:
> This has no effect:
> _bars.each!(a => { a._plots.fillColor = Color(255, 180, 0);
});
This is a common issue especially for people who know lambdas
from other languages. :)
Your lambda does not do
On Wednesday, 27 April 2016 at 23:30:10 UTC, Nicholas Wilson
wrote:
On Wednesday, 27 April 2016 at 13:00:29 UTC, RuZzz wrote:
Code:
import std.concurrency;
import core.thread;
//import vibe.http.client; // If uncommented this
line, the thread "worker" does not start
void w
On Wednesday, 20 April 2016 at 19:58:15 UTC, Tofu Ninja wrote:
How does D not have shallow copy? Seems like a very basic
functionality...
You could implement a `dup()` method. `dup` is already used for
shallow copying of arrays, why not reuse it for classes (as a
convention)?
Which platform/OS, dmd version, and command line are you using?
On Friday, 15 April 2016 at 05:35:24 UTC, Uranuz wrote:
In my program I have error with circular imports of modules
with static ctors. So I decided to move ctors in separate file
and import it only from the 1st file. But problem is that in
the first file I have immutables that should be initial
On Thursday, 7 April 2016 at 08:06:03 UTC, Puming wrote:
On Thursday, 7 April 2016 at 07:45:06 UTC, yawniek wrote:
what is the way one is supposed to parse e.g. a
double of unixtime (as delived by nginx logs) into a SysTime?
currently i'm creating a wrapper struct around SysTime with
alias thi
On Thursday, 24 March 2016 at 08:24:15 UTC, eastanon wrote:
On Thursday, 24 March 2016 at 06:34:51 UTC, rikki cattermole
wrote:
As a little fun thing to do I implemented it for you.
It won't allocate. Making this perfect for you.
With a bit of work you could make Result have buffers for
result
On Wednesday, 23 March 2016 at 21:37:09 UTC, Lucien wrote:
When I remove the Thread.sleep, it doesn't find all adresses.
Why ?
Socket.select() will wait _at most_ 100 msecs. If a socket gets
ready before that timeout, it will return immediately. Therefore,
you might not get the full TIMES*100
On Wednesday, 23 March 2016 at 20:54:20 UTC, Yuxuan Shui wrote:
Say:
module one;
void func(int a){}
/
module two;
import one;
void func(float a){}
Is there a way to get both func() in module two?
Add in module two:
alias func = one.func;
On Saturday, 19 March 2016 at 09:55:13 UTC, Lucien wrote:
const int MAX = 64;
Socket[] sockets = new Socket[MAX];
string ipb = "192.168.0.";
for (int i = 1; i < MAX; i++) {
Here's the reason for your SEGV: You need to start at 0, because
otherwise `sockets[0]` is `null`. When
On Friday, 18 March 2016 at 10:50:34 UTC, Dsby wrote:
foreach (i ; 0..4) {
auto th = new Thread(delegate(){listRun(i);});//this is erro
_thread[i]= th;
th.start();
}
void listRun(int i)
{
writeln("i = ", i); // the value is not(0,1,2,3), it all
is 2.
}
I want to
Looking at an strace of nmap, it seems it opens a bunch of
sockets, puts them into non-blocking mode, calls connect on them
(which will return EINPROGRESS), and then uses select(2) to wait
for them (in a loop, until all have either been accepted or
rejected). select(2) accepts a timeout value,
On Wednesday, 16 March 2016 at 22:22:15 UTC, Anonymouse wrote:
import core.thread; // for .seconds
Nitpick: `seconds` is defined in `core.time`; `core.thread` just
reexports it.
s.setOption(SocketOptionLevel.SOCKET, SNDTIMEO, 10.seconds);
s.setOption(SocketOptionLevel.SOCKET, RCVTIMEO, 10.
On Thursday, 17 March 2016 at 17:09:46 UTC, Steven Schveighoffer
wrote:
On 3/16/16 6:37 PM, Mathias Lang wrote:
On Wednesday, 16 March 2016 at 21:49:05 UTC, Steven
Schveighoffer wrote:
No, please don't. Assigning a signed value to an unsigned
(and vice
versa) is very useful, and there is no goo
On Monday, 14 March 2016 at 14:46:06 UTC, Orkhan wrote:
On Monday, 14 March 2016 at 11:11:28 UTC, Ali Çehreli wrote:
On 03/14/2016 02:56 AM, Orkhan wrote:
> THe output like that :
> root@ubuntu:/opt/xcomm# gdmd
> Can't exec "/usr/local/bin/gdc": No such file or directory at
Ok, now you need to
On Sunday, 13 March 2016 at 14:07:31 UTC, Basile B. wrote:
'$' is only valid in an indexExpression
(https://dlang.org/spec/grammar.html#IndexExpression),
so it can only be followed by
- ' '
- ']'
- operators , usually '-' but also '/', '+', '>>' etc
Is that right ?
I'd like to relax the lexi
On Friday, 11 March 2016 at 12:10:53 UTC, Artur Skawina wrote:
On 03/11/16 09:21, Ali Çehreli via Digitalmars-d-learn wrote:
You've been bitten by a common usability issue. :)
On 03/11/2016 12:02 AM, Fynn Schröder wrote:
static if (is(U == ubyte)) {
} else if (is(U == ushort)) {
On Wednesday, 9 March 2016 at 16:13:38 UTC, Minas Mina wrote:
Hello, I have followed the instructions here
(http://wiki.dlang.org/Starting_as_a_Contributor#POSIX) to
install DMD, druntime and phobos from source.
My platform is Ubuntu 15.10 x64.
This is the error I get:
http://pastebin.com/kWC
On Tuesday, 23 February 2016 at 08:00:24 UTC, Nicholas Wilson
wrote:
Silly question. Why is this necessary?
Due to a problem with the implementation, associative arrays
currently can't be initialized statically. We hope it will
eventually get fixed, but until then, you have to use module
con
On Tuesday, 23 February 2016 at 11:10:40 UTC, ixid wrote:
We really need to standard algorithms to be fast and perhaps
have separate ones for perfect technical accuracy.
While I agree with most of what you're saying, I don't think we
should prioritize performance over accuracy or correctness
On Thursday, 18 February 2016 at 07:21:05 UTC, Chris Katko wrote:
Hello. I'm almost brand-new to the D language and still
absorbing things.
I'm wondering if it's possible to fire off a compile-time (or
worst case, a run-time) warning or error if a function is
called, but the return value is n
On Wednesday, 17 February 2016 at 01:45:24 UTC, Rikki Cattermole
wrote:
On 17/02/16 1:19 PM, Seb wrote:
In any case such a next method would be very easy to implement
(see
below) and thus I am wondering why it isn't part of phobos?
```
auto next(Range)(ref Range a){
auto b = a.front;
On Tuesday, 16 February 2016 at 04:00:27 UTC, Mike Parker wrote:
On Tuesday, 16 February 2016 at 03:39:00 UTC, Matt Elkins wrote:
On Tuesday, 16 February 2016 at 03:31:51 UTC, maik klein wrote:
In D you can always call Foo.init even with @disable this(),
Foo.init can be called implicitly (not
On Saturday, 13 February 2016 at 14:53:39 UTC, ZombineDev wrote:
On Saturday, 13 February 2016 at 10:22:36 UTC, Marc Schütz
wrote:
On Friday, 12 February 2016 at 21:56:09 UTC, Steven
Schveighoffer wrote:
That's odd. I think anonymous probably has the answer (they
are context pointers), bu
On Friday, 12 February 2016 at 21:56:09 UTC, Steven Schveighoffer
wrote:
That's odd. I think anonymous probably has the answer (they are
context pointers), but I'm also surprised they are null, they
shouldn't be.
In this example, `void foo()` doesn't access any outer variables,
so there's no
On Tuesday, 9 February 2016 at 14:28:35 UTC, Ola Fosheim Grøstad
wrote:
On Tuesday, 9 February 2016 at 13:43:16 UTC, Marc Schütz wrote:
So what? Using that argument, you could just as well forbid
taking the address of any variable. What's so special about
tuples, in contrast to struct
On Tuesday, 9 February 2016 at 11:38:14 UTC, Ola Fosheim Grøstad
wrote:
On Tuesday, 9 February 2016 at 10:54:42 UTC, Marc Schütz wrote:
No need to restrict the language here, there's nothing
stopping a decent compiler from storing tuples (actually
_anything_) in registers, in some cases
On Tuesday, 9 February 2016 at 09:05:58 UTC, Ola Fosheim Grøstad
wrote:
IMO one shouldn't be able to take the reference of a tuple, to
ensure that it can be kept in registers.
No need to restrict the language here, there's nothing stopping a
decent compiler from storing tuples (actually _anyth
The specification doesn't list (non-static) members a valid
template alias parameters:
http://dlang.org/spec/template.html#TemplateAliasParameter
On Saturday, 6 February 2016 at 13:36:32 UTC, Márcio Martins
wrote:
I came across an issue with UDAs and was wondering if there
really is no way or if I just missed something...
Basically, my library has an @ignore UDA, which conflicts with
vibe.d's vibe.data.serialization.
If both mine and
On Friday, 5 February 2016 at 19:48:45 UTC, Robert M. Münch wrote:
I thought about it too, but I need it to work with more then
one parameter, so I tried this which doesn't work:
Value nativePlus(Value a, Value b){
// @@ not working, runtime exception
castSwitch!(
(IntV a) {
castS
Does the following help?
import std.algorithm.comparison : castSwitch;
import std.stdio;
class A { }
class B : A { }
class C : A { }
auto foo_impl(B b) {
writeln("called foo(B)");
}
auto foo_impl(C c) {
writeln("called foo(C)");
}
auto foo(A a) {
return a.castSwitch!(
(B b)
On Friday, 5 February 2016 at 07:04:27 UTC, cy wrote:
Mind if I elaborate on this a bit? If that is unrolled, I
understand it will unroll into several calls to write, as in
print("1","2","3") => write("1"," ");write("2","
");write("3","\n");
Up to here, yes.
And presumably, write() unrolls
On Friday, 5 February 2016 at 08:45:00 UTC, Minas Mina wrote:
Use assertions when a variable's value should not depend on
external factors.
For example, let's say you want to write a square root function.
The input must be >= 0, and because this depends on external
factors (e.g. user input), yo
On Wednesday, 3 February 2016 at 16:07:59 UTC, Messenger wrote:
What is a good way to try to force it? Using enum? Then
optionally copying the value once to avoid the "manifest
constant" copy/paste behaviour, where applicable?
template forceCTFE(alias expr) {
alias forceCTFE = expr;
}
aut
On Wednesday, 3 February 2016 at 10:16:56 UTC, Saurabh Das wrote:
Why doesn't this work? Is it a requirement that a proxied
struct must have a nothrow destructor and toHash?
It used to work in 2.066.1; bisecting points to this PR:
https://github.com/D-Programming-Language/phobos/pull/3043
When
On Tuesday, 2 February 2016 at 14:55:42 UTC, Daniel Kozak wrote:
On Tuesday, 2 February 2016 at 14:47:43 UTC, Marc Schütz wrote:
if you mix ints and floats, the common type is deduced
correctly:
this is a bug for me :). I do not like this. I am ok with
(u)byte to int conversion and similar
On Tuesday, 2 February 2016 at 14:12:54 UTC, Daniel Kozak wrote:
On Tuesday, 2 February 2016 at 13:57:54 UTC, Marc Schütz wrote:
On Tuesday, 2 February 2016 at 13:52:55 UTC, Marc Schütz wrote:
The last call should work IMO, but it doesn't. I believe
that's a compiler bug.
Fi
On Tuesday, 2 February 2016 at 13:52:55 UTC, Marc Schütz wrote:
The last call should work IMO, but it doesn't. I believe that's
a compiler bug.
Filed:
https://issues.dlang.org/show_bug.cgi?id=15640
On Tuesday, 2 February 2016 at 13:20:33 UTC, Voitech wrote:
Hi, Is it possible to bound T... in template with some type ?
For single Parameter declaration it can be done by T:SomeType
but variadics does not seems to have that possibility ?
Cheers
Two possible solutions... If you don't need to
On Tuesday, 2 February 2016 at 09:51:52 UTC, Marc Schütz wrote:
The constraint that fails is the one with `CommonType`:
pragma(msg, CommonType!(const(B), const(C))); // void
`CommonType` uses the `?:` operator to derive the common type:
writeln(true ? b : c);
// Error
The constraint that fails is the one with `CommonType`:
pragma(msg, CommonType!(const(B), const(C))); // void
`CommonType` uses the `?:` operator to derive the common type:
writeln(true ? b : c);
// Error: incompatible types for ((b) : (c)): 'const(B[])'
and 'const(C[])'
write
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
I am getting runtime error:
core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
At least tell me can anyone replicate it?
M
On Thursday, 28 January 2016 at 07:45:01 UTC, Robert M. Münch
wrote:
Just compiled the latest release with digger. Everything works
without any problems, but the resulting binary shows the
following version:
mac-pro:Digger robby$ ./result/bin/dmd --version
DMD64 D Compiler v2.069-devel-682687b
On Tuesday, 26 January 2016 at 13:56:39 UTC, Igor wrote:
//ubyte[__traits(classInstanceSize, App)] buffer;
auto buffer =
core.stdc.stdlib.malloc(__traits(classInstanceSize,
App))[0..__traits(classInstanceSize, App)];
works, so it is the ubyte line.
Can you please post the f
On Sunday, 24 January 2016 at 06:07:13 UTC, Alex Vincent wrote:
(1) It's not clear how to specify certain parts of a module or
library as non-exportable. Is that possible? Is it desirable?
(It's not that important, yet, but still...)
Yes, definitely. By default symbols in a module are `publ
On Friday, 21 June 2013 at 14:08:43 UTC, Sergei Nosov wrote:
If I have a function
auto apply(alias fun, T...)(T args)
{
return fun(args);
}
And then I have
int y = 2;
apply!(x => y)(1);
How in the world does this work? Is the context address known
at compile-time?
No, but because lambdas
On Friday, 22 January 2016 at 13:03:52 UTC, Darrell Gallion wrote:
On Friday, 22 January 2016 at 11:23:56 UTC, Marc Schütz wrote:
On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion
wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
On Friday, 22 January 2016 at 10:15:19 UTC, Mike Parker wrote:
A static variable is still a runtime variable. It's effectively
the same as declaring a variable outside of the function scope
at module scope, except that it's visible only in the current
scope and the function name gets mangled in
On Friday, 22 January 2016 at 01:33:42 UTC, Darrell Gallion wrote:
void foo(A)()
if (!is (A == int)) {
pragma(msg, "int");
}
void foo(A)()
if (is (A == int[])) {
pragma(msg, "int[]");
}
void main() {
foo!(int)();
foo!(int[])();
}
===
source\app.d(15): Erro
On Wednesday, 20 January 2016 at 16:37:31 UTC, jmh530 wrote:
I'm not sure if this is how the behavior is supposed to be or
if it is a bug.
It's not a bug. The `@attribute:` syntax applies to all following
declarations _inside the current scope_, i.e. until your mixin
templates closing `}`.
On Wednesday, 20 January 2016 at 16:37:31 UTC, jmh530 wrote:
I'm not sure if this is how the behavior is supposed to be or
if it is a bug.
I believe, however, that it _is_ a bug that the imported symbols
are visible outside the template. Most likely related to the
infamous https://issues.dlan
Here's what I suggest:
alias T = int;
class VariableLengthClass {
private:
string someMember;
size_t length_;
T[0] data_;
public:
static make(Args...)(size_t length, Args args) {
static assert(
typeof(this).init.data_.offsetof ==
__traits(classInstanceSize
On Tuesday, 12 January 2016 at 16:55:48 UTC, ParticlePeter wrote:
I can rewrite the definition of otherFunc like this:
void otherFunc( MF mf );
But I cannot pass an anonymous function to otherFunc like this:
otherFunc( MF { myCode; } );
Thats what I want. Any working example?
If I understand
On Tuesday, 12 January 2016 at 15:41:02 UTC, ParticlePeter wrote:
I have a function type and variable and assign a function to it:
void function( int i ) myFunc;
myFunc = void function( int i ) { myCode; }
How would I declare an alias for void function( int i ) such
that the case above would w
On Sunday, 10 January 2016 at 01:16:43 UTC, Ilya Yaroshenko wrote:
On Saturday, 9 January 2016 at 23:20:00 UTC, Jay Norwood wrote:
I'm playing around with win32, v2.069.2 dmd and
"dip80-ndslice": "~>0.8.8". If I convert the 2D slice with
.array(), should that first dimension then be compatible
On Monday, 4 January 2016 at 12:20:09 UTC, Ur@nuz wrote:
On Monday, 4 January 2016 at 12:00:32 UTC, tcak wrote:
On Monday, 4 January 2016 at 10:50:17 UTC, Ur@nuz wrote:
Sorry, the actual code is:
...
lines ~= ' '.repeat.take(newIndentCount).array;
...with character quotes. But it still fails
On Monday, 4 January 2016 at 13:49:03 UTC, Martin Tschierschke
wrote:
When I was writing a small speed test - D versus Ruby,
calculating the first n prime numbers, I realized, that for
small n
Ruby may be faster, than compiling and executing with D.
But for n = 1,000,000 D outperforms Ruby by a
On Saturday, 2 January 2016 at 12:08:48 UTC, Meta wrote:
On Saturday, 2 January 2016 at 12:07:31 UTC, John Colvin wrote:
You are manually breaking immutable by making a union of
immutable and mutable data and then writing to the mutable
reference. This is roughly equivalent to casting away
imm
On Monday, 21 December 2015 at 09:46:58 UTC, Shriramana Sharma
wrote:
Jonathan M Davis via Digitalmars-d-learn wrote:
If it isn't, all that means is that the
array's capacity will be 0, so it's going to have to reallocate
So it's safe to return a string produced by fromStringz without
having
1 - 100 of 166 matches
Mail list logo