Search

4 days ago
Learn »
...parameters, if (0), strongly pure functions returning void etc.

In my experience, doing this rarely...
4 days ago
General »
...serialise;

void serialise(T)(void[] buffer, T)
  if (isSomeInt!T)
{ /* serialise integer */ }

void serialise(void...
4 days ago
Learn »
...return volatileLoad(&value);
    }
    alias read this;

    public void opAssign(T value)
    {
        volatileStore(&this.value, value...
5 days ago
Learn »
...std.string : format;
import std.stdio  : writeln;

void main()
{
  enum text = "sixtwoone";

  auto test = FixedStr...
5 days ago
Learn »
...being 1, today this passes:

struct S {}

void main() {
    S[2] ses;
    assert(&ses[0...
5 days ago
Learn »
...T v;

    T get()
    {
        return volatileLoad(&v);
    }

    void opAssign(T v)
    {
        volatileStore(&this.v, v...
5 days ago
Learn »
...user.username == username)
        {
            return user;
        }
    }

    return null;
}


void main()
{

    shared User alice = new shared User...
5 days ago
Learn »
...int gInt;

    void initialize(int initialValue = 0)
    {
        mutex = new Mutex();
        gInt = initialValue;
    }

    void increment(int...
5 days ago
Learn »
...Method to safely increment the global variable
    void increment(int value)
    {
        synchronized(mutex)
        {
            gInt.atomicOp...
6 days ago
Learn »
...the thread function.
void modify(int increment) {
    while (!stopRequested) {
        g.atomicOp!"+="(increment);
    }
}

void main() {
    // Spawn...
1 2 3 4
Next ›   Last »