Value.opEquals

  1. bool opEquals(auto ref const Value other)
  2. bool opEquals(in T other)
    struct Value
    @safe
    bool
    opEquals
    const nothrow @nogc
    (
    T
    )
    (
    in T other
    )
    if (
    isValue!T
    )

Examples

ditto

1 assert(Value(null) != Value(1));
2 
3 // null
4 assert(Value(null) == null);
5 assert(Value(null) == Value(null));
6 
7 // bool
8 assert(Value(false) == false);
9 assert(Value(true)  == Value(true));
10 
11 // integer
12 assert(Value(0xDEADC0DE) == 0xDEADC0DE);
13 assert(Value(0X12345678) == Value(0X12345678));
14 
15 // floating point
16 assert(Value(1234.5678) == 1234.5678);
17 assert(Value(9876.5432) == Value(9876.5432));
18 
19 // bytes
20 ubyte[] a = [1,2,3,4];
21 ubyte[] b = [1,2,3,4];
22 assert(Value(a) == b);
23 assert(Value(a) == Value(b));
24 
25 // string
26 assert(Value("foo") == "foo");
27 assert(Value("bar") == Value("bar"));
28 
29 // array
30 assert(Value(["foo","bar"]) == Value(["foo","bar"]));
31 
32 // map
33 assert(Value(["foo":"bar", "fuz":"buz"]) == Value(["fuz":"buz", "foo":"bar"]));

Meta