On Wednesday, 17 January 2018 at 22:56:09 UTC, kinke wrote:
On Wednesday, 17 January 2018 at 22:01:57 UTC, Johan Engelen
wrote:
```
struct GSharedVariable(AddrSpace as, T)
{
static __gshared T val;
alias val this;
}
alias Global(T) = GSharedVariable!(AddrSpace.Global, T);
On Wednesday, 17 January 2018 at 22:01:57 UTC, Johan Engelen
wrote:
```
struct GSharedVariable(AddrSpace as, T)
{
static __gshared T val;
alias val this;
}
alias Global(T) = GSharedVariable!(AddrSpace.Global, T);
Global!float bar1; // __gshared
```
Only 1 value per T though. ;)
On Friday, 12 January 2018 at 04:25:25 UTC, Nicholas Wilson wrote:
Is there a way to make __gshared part of an alias?
Hi Nick, how about this?
```
struct GSharedVariable(AddrSpace as, T)
{
static __gshared T val;
alias val this;
}
alias Global(T) = GSharedVariable!(AddrSpace.Global
On Wednesday, January 17, 2018 10:44:24 Nicholas Wilson via Digitalmars-d-
learn wrote:
> On Wednesday, 17 January 2018 at 07:53:24 UTC, Jonathan M Davis
>
> wrote:
> > I don't know what you're doing, and maybe __gshared is the
> > appropriate solution for what you're trying to do, but in
> >
On Wednesday, 17 January 2018 at 07:53:24 UTC, Jonathan M Davis
wrote:
I don't know what you're doing, and maybe __gshared is the
appropriate solution for what you're trying to do, but in
general, if you're not trying to bind to a C global variable,
you should be using shared, and using
On Wednesday, January 17, 2018 07:30:30 Nicholas Wilson via Digitalmars-d-
learn wrote:
> On Wednesday, 17 January 2018 at 02:37:07 UTC, Steven
>
> Schveighoffer wrote:
> > On 1/11/18 11:25 PM, Nicholas Wilson wrote:
> >> Is there a way to make __gshared part of an alia
On Wednesday, 17 January 2018 at 02:37:07 UTC, Steven
Schveighoffer wrote:
On 1/11/18 11:25 PM, Nicholas Wilson wrote:
Is there a way to make __gshared part of an alias?
No, __gshared is a storage class, not a type constructor, so it
has no meaning as part of a type:
__gshared int x;
int y
On 1/11/18 11:25 PM, Nicholas Wilson wrote:
Is there a way to make __gshared part of an alias?
No, __gshared is a storage class, not a type constructor, so it has no
meaning as part of a type:
__gshared int x;
int y;
static assert(is(typeof(x) == typeof(y)));
as in
enum AddrSpace : uint
Is there a way to make __gshared part of an alias?
as in
enum AddrSpace : uint
{
Private = 0,
Global = 1,
Shared = 2,
Constant = 3,
Generic = 4,
}
struct Variable(AddrSpace as, T)
{
T val;
alias val this;
}
alias Global(T) = __gshared Variable