On Monday, June 12, 2017 20:40:52 Balagopal Komarath via Digitalmars-d-learn
wrote:
> Is there a way to avoid the following combinatorial explosion of
> overloaded functions when overloading for lvalue and rvalue
> arguments? The following may be a bad example because int is
> cheap to copy. So as
Is there a way to avoid the following combinatorial explosion of
overloaded functions when overloading for lvalue and rvalue
arguments? The following may be a bad example because int is
cheap to copy. So assume a large datatype instead of int.
import std.stdio;
void foo(in ref int a, in ref i
On Mon, Jun 12, 2017 at 01:08:13PM -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 06/12/2017 01:03 PM, Gary Willoughby wrote:
> > On Monday, 12 June 2017 at 19:36:52 UTC, H. S. Teoh wrote:
>
> >> public inout Rational opBinary(string op)(inout Rational rhs)
>
> > Quick question abou
On 06/12/2017 01:03 PM, Gary Willoughby wrote:
> On Monday, 12 June 2017 at 19:36:52 UTC, H. S. Teoh wrote:
>> public inout Rational opBinary(string op)(inout Rational rhs)
> Quick question about the signature, if I change it to (note the parens):
>
>public inout(Rational) opBinary(stri
On Monday, 12 June 2017 at 19:36:52 UTC, H. S. Teoh wrote:
On Mon, Jun 12, 2017 at 07:38:44PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
In the following code is there any way to make the `opBinary`
method generic to be able to accept immutable as well as a
standard type? The code cu
On Monday, 12 June 2017 at 19:51:37 UTC, Gary Willoughby wrote:
I don't know how H. S. Teoh managed to answer 'before' I posted
but thanks guys! :)
might be a bug, happened here
http://forum.dlang.org/post/ohbr5l$2mng$1...@digitalmars.com also.
I don't know how H. S. Teoh managed to answer 'before' I posted
but thanks guys! :)
Arafel wrote:
I actually found a workaround for the original issue:
yeah, sorry for not proposing a workaround: i thought that you already did
it, and now you're just interested why the original code doesn't work. ;-)
i think that this is a bug (or, rather, unimplemented feature).
Gary Willoughby wrote:
In the following code is there any way to make the `opBinary` method
generic to be able to accept immutable as well as a standard type? The
code currently passes the unit test but I wonder if I could get rid of
the duplication to overload the operator? I'm failing badly.
On Mon, Jun 12, 2017 at 07:38:44PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
> In the following code is there any way to make the `opBinary` method
> generic to be able to accept immutable as well as a standard type? The
> code currently passes the unit test but I wonder if I could get
On Monday, 12 June 2017 at 19:23:10 UTC, ketmar wrote:
p.s.: while i understand the technical reason for second error
message, it is still random and confusing.
I think the reason for the typeof problem is that it works with
expressions, not with types (so, typeof (int) is also not valid),
an
In the following code is there any way to make the `opBinary`
method generic to be able to accept immutable as well as a
standard type? The code currently passes the unit test but I
wonder if I could get rid of the duplication to overload the
operator? I'm failing badly.
import std.stdio;
s
p.s.: while i understand the technical reason for second error message, it
is still random and confusing.
more funny compiler messages:
alias xx = size_t function (int[]);
struct S1(T, typeof(xx) X) {}
void main() {
S1!(int, defaultChooser!int) s;
}
Error: type uint function(int[]) is not an expression
but:
struct S2(T, typeof(defaultChooser!T) cho
On Mon, Jun 12, 2017 at 06:16:06PM +, Stefan Koch via Digitalmars-d-learn
wrote:
> On Monday, 12 June 2017 at 06:15:07 UTC, Biotronic wrote:
[...]
> > On a multi-core system we can do better:
> >
> > auto nums = iota(10_000_000.0f);
> > auto sum = taskPool.reduce!"a + b"(nums);
> >
> > Given
On 06/11/2017 06:02 PM, helxi wrote:
Is it possible to sum an array in O(1)?
It's possible to maintain the sum as elements are added and removed.
Then, accessing it would be O(1).
Ali
On Monday, 12 June 2017 at 06:15:07 UTC, Biotronic wrote:
On Monday, 12 June 2017 at 01:36:04 UTC, Stefan Koch wrote:
On Monday, 12 June 2017 at 01:02:58 UTC, helxi wrote:
Is it possible to sum an array in O(1)?
No.
If you want to sum the elements you have to at-least look at
all the element
On 06/12/2017 05:31 PM, Arafel wrote:
Hi,
I've found a strange problem, and I'm not sure if it's a bug. To give a
bit of background, I'm implementing a multi-threaded producer-consumer
where the next work item to be picked depends not only on the "waiting
queue", but also on what else is bein
Hi,
I've found a strange problem, and I'm not sure if it's a bug. To give a
bit of background, I'm implementing a multi-threaded producer-consumer
where the next work item to be picked depends not only on the "waiting
queue", but also on what else is being run (and potentially where) at
the s
I was working around with regex trying to match certain patterns
of repeating patterns before and after a space and I came across
some unexpected behavior.
writeln("ABC ABC CBA".replaceAll(regex(r"([A-Z]) ([A-Z])"),
"D"));
//ABDBDBA
//Makes sense, replaces the 3 characters surroundi
On Sun, 2017-06-04 at 21:32 +0200, Jacob Carlborg via Digitalmars-d-
learn wrote:
> On 2017-06-04 19:05, Patrick Schluter wrote:
>
> > buildPath("/usr/bin", "/usr/bin/gcc")
> >
> > /usr/bin/usr/bin/gcc is obviously wrong.
>
> Says who? It might be exactly what I want. The case that came up is
>
On Sun, 2017-06-11 at 13:21 +, Ryan Frame via Digitalmars-d-learn
wrote:
> On Sunday, 4 June 2017 at 18:15:36 UTC, Russel Winder wrote:
> > On Sun, 2017-06-04 at 17:56 +0200, Jacob Carlborg via
> > Digitalmars-d- learn wrote:
> > > On 2017-06-04 07:44, Jesse Phillips wrote:
> > >
> > > > What
22 matches
Mail list logo