On Tuesday, 27 March 2018 at 15:37:11 UTC, SimonN wrote:
On Tuesday, 27 March 2018 at 15:28:40 UTC, jmh530 wrote:
static if (isMutable!T)
bag[0] = rhs;
else
bag = [rhs];
I like this idea. I'd even take it a step futher:
When T is a pointer or class
On Tuesday, 27 March 2018 at 15:28:40 UTC, jmh530 wrote:
static if (isMutable!T)
bag[0] = rhs;
else
bag = [rhs];
I like this idea. I'd even take it a step futher:
When T is a pointer or class reference, then we can put the
reference on the stack
On Tuesday, 27 March 2018 at 13:51:20 UTC, jmh530 wrote:
How about:
[snip]
I can kind of like this more, but after re-reading your original
post I'm not sure it really resolves your issue:
struct Optional(T) {
import std.traits : isMutable;
T[] bag;
this(T t) inout {
On Monday, 26 March 2018 at 14:17:03 UTC, Jonathan M Davis wrote:
Rebindable does is pretty questionable as far as the type
system goes, but it does what it does by forcing pointer
semantics on a class reference, so the point is arguable.
Yeah, I've always assumed that Rebindable cannot be
On Tuesday, 27 March 2018 at 13:02:50 UTC, aliak wrote:
Hmm, now that I'm explicitly trying to produce it, I feel I
maybe using inout incorrectly?
struct Optional(T) {
T[] bag;
this(T t) {
bag = [t];
}
}
struct S {
Optional!(inout(int)) f() inout
{
return
On Tuesday, 27 March 2018 at 11:57:28 UTC, jmh530 wrote:
On Tuesday, 27 March 2018 at 06:26:57 UTC, aliak wrote:
[snip]
By the by, how come inout has to be stack based and
const/immutable/mutable doesn't? Isn't inout just one of those
depending on context?
Example?
Hmm, now that I'm
On Tuesday, 27 March 2018 at 06:26:57 UTC, aliak wrote:
[snip]
By the by, how come inout has to be stack based and
const/immutable/mutable doesn't? Isn't inout just one of those
depending on context?
Example?
On Monday, 26 March 2018 at 11:19:31 UTC, Seb wrote:
On Monday, 26 March 2018 at 10:13:08 UTC, Simen Kjærås wrote:
On Monday, 26 March 2018 at 09:46:57 UTC, Nicholas Wilson
wrote:
Have a look at Rebindable:
https://dlang.org/phobos/std_typecons.html#rebindable
Allow me to quote from aliak's
On Monday, 26 March 2018 at 21:17:10 UTC, jmh530 wrote:
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
Hi, I have this optional type I'm working on and I've run in
to a little snag when it comes to wrapping an immutable.
Basically what I want is for an Optional!(immutable T) to
still
On Sunday, 25 March 2018 at 23:00:11 UTC, Simen Kjærås wrote:
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
struct Optional(T) {
Unqual!T value;
opAssign(T t) {
value = cast(Unqual!T)(t);
}
}
Consider this case:
Optional!(immutable int) a = some(3);
immutable int* p =
a =
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
Hi, I have this optional type I'm working on and I've run in to
a little snag when it comes to wrapping an immutable. Basically
what I want is for an Optional!(immutable T) to still be
settable to "some" value or "no" value because the
On Monday, March 26, 2018 10:13:08 Simen Kjærås via Digitalmars-d-learn
wrote:
> On Monday, 26 March 2018 at 09:46:57 UTC, Nicholas Wilson wrote:
> > Have a look at Rebindable:
> > https://dlang.org/phobos/std_typecons.html#rebindable
>
> Allow me to quote from aliak's post:
> > what I'm looking
On Monday, 26 March 2018 at 10:13:08 UTC, Simen Kjærås wrote:
On Monday, 26 March 2018 at 09:46:57 UTC, Nicholas Wilson wrote:
Have a look at Rebindable:
https://dlang.org/phobos/std_typecons.html#rebindable
Allow me to quote from aliak's post:
what I'm looking for is a Rebindable
On Monday, 26 March 2018 at 09:46:57 UTC, Nicholas Wilson wrote:
Have a look at Rebindable:
https://dlang.org/phobos/std_typecons.html#rebindable
Allow me to quote from aliak's post:
what I'm looking for is a Rebindable implementation that's for
value types
As can be surmised from the
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
Hi, I have this optional type I'm working on and I've run in to
a little snag when it comes to wrapping an immutable. Basically
what I want is for an Optional!(immutable T) to still be
settable to "some" value or "no" value because the
On Sunday, 25 March 2018 at 23:00:11 UTC, Simen Kjærås wrote:
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
struct Optional(T) {
Unqual!T value;
opAssign(T t) {
value = cast(Unqual!T)(t);
}
}
Consider this case:
Optional!(immutable int) a = some(3);
immutable int* p =
a =
On Sunday, 25 March 2018 at 21:26:57 UTC, aliak wrote:
struct Optional(T) {
Unqual!T value;
opAssign(T t) {
value = cast(Unqual!T)(t);
}
}
Consider this case:
Optional!(immutable int) a = some(3);
immutable int* p =
a = some(5);
Clearly the above code shouldn't compile - you can't
Hi, I have this optional type I'm working on and I've run in to a
little snag when it comes to wrapping an immutable. Basically
what I want is for an Optional!(immutable T) to still be settable
to "some" value or "no" value because the Optional wrapper itself
is mutable.
Optional!(immutable
18 matches
Mail list logo